How can I get the RGB values ​​of the image "TYPE_3BYTE_BGR"?

I have an image with TYPE_3BYTE_BGR and I want to convert it to TYPE_INT_RGB .

Although I searched, I did not find a method for this. I want to convert image pixel to pixel. However, it seems that BufferedImage.getRGB(i, j) not working.

How can I get the RGB values ​​in an image of type TYPE_3BYTE_BGR ?

+3
source share
1 answer

I'm not sure what you mean by "getRGB (i, j) does not work." getRGB returns a packed int; you need to decode it.

 int color = image.getRGB(i,j); int r = (argb)&0xFF; int g = (argb>>8)&0xFF; int b = (argb>>16)&0xFF; int a = (argb>>24)&0xFF; 

See How to convert an integer pixel get.rgb (x, y) to color (r, g, b, a) in Java?

+2
source

All Articles