I have an integer array of RGB pixels that looks something like this:
pixels[0] = <rgb-value of pixel(0,0)> pixels[1] = <rgb-value of pixel(1,0)> pixels[2] = <rgb-value of pixel(2,0)> pixels[3] = <rgb-value of pixel(0,1)> ...etc...
And I'm trying to create a BufferedImage. I tried the following:
BufferedImage img = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB); img.getRaster().setPixels(0, 0, width, height, pixels);
But the resulting image has problems with color bars. The image is fuzzy, and diagonal and horizontal lines pass through it.
What is the correct way to initialize an image using rgb values?
EDIT: This is what my image looks like 
thanks jeff
source share