views:

33

answers:

1

I'm trying to determine if an image is a simple black and white image, or if it has color (using Java). If it has color, I need to display a warning message to the user that the color will be lost.

+3  A: 
Tom Smilack
I actually am only worried about pure black and white (not gray scale) vs. anything else. So in that case, would I only worry about when r, g, and b all equal 255 or all equal 0?
Lukas
Yes, that should be the case. Although if you make a BufferedImage without transparency (e.g., TYPE_INT_RGB), then you could just check that the pixel == 0xFFFFFF or 0x0 and save a few lines.
Tom Smilack