BufferedImage question

P

Peter Ashford

Hi

I'm loading GIFs using imageio.read()

How do I tell whether the image is greyscale or not? For greyscale
GIFs, image.getColorModel().getColorSpace().getNumComponents() returns
3, whereas I thought I'd get 1 for a greyscale image. What am I doing
wrong?
 
B

Boudewijn Dijkstra

Peter Ashford said:
Hi

I'm loading GIFs using imageio.read()

How do I tell whether the image is greyscale or not? For greyscale
GIFs, image.getColorModel().getColorSpace().getNumComponents() returns
3, whereas I thought I'd get 1 for a greyscale image. What am I doing
wrong?

The image may be converted to a (coloured) bitmap at the moment you query
it. To retrieve information from the original stream, I suppose you should
construct a javax.imageio.ImageReader and query it.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top