Create a byte[]
with the rgb values for each pixel of the image you want. The byte[]
length will be width * height * 3
(3 values for each pixel). Look at this for an example of how create a BufferedImage
from the byte[]
.
Another alternative is to create a BufferedImage and set the rgb value for each pixel directly. In this case, you have to bit twiddle all 3 rgb values into a single int
value.
3
solved Java GUI program to convert 2D array value into graphic [closed]