How to check if an image is 8 bit or 16 bit?

im does an APP that does image processing using java SE.i to check programmatically at runtime whether the image is 8-bit or 16-bit? and then, according to what I am doing image processing on this .so, how can I check this in java?

+3
source share
2 answers

There is a message here that is trying to read the 8-bit and 24-bit BMP file.  http://www.javaworld.com/javaworld/javatips/jw-javatip43.html?page=2

Here he tries to get the number of bits, like this:

int nbitcount = (((int)bi[15]&0xff)<<8) | (int)bi[14]&0xff

Once you get this counter, you can check what type of image it is based on this number of bits.

+1
source

BufferedImage, getType().

+1

All Articles