I have an array in Java called pic[400][400][3]
I put that array in a method that makes it into an image.
Before I call the method to make the array into a picture, I want to change the color values for each pixel. I am struggling with the concept of how to select the value I want to alter and then what I need to enter to adjust the color values in the array. Any help is appreciated.
pic[xcoord][ycoord][0]
would be red.
pic[xcoord][ycoord][1]
would be blue.
pic[xcoord][ycoord][2]
would be green.
This would be easier, however, with a BufferedImage
. There is getRGB()
, setRGB()
, and it supports alpha values. It is also a lot easier to save and load images.