Graphics.drawBytes()
is used for drawing text (and it's not very good for that, as it uses byte[], rather than char[] or String, thus not supporting charsets) onto the image.
Graphics.drawBytes()
can't be used to draw raw pixels.
To get a correct representation of your image, you should rather create a new BufferedImage
from your pixel data, or create a matching image and set the data onto it. Have a look at the Raster
and DataBuffer
classes.