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.
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
2010-09-13 19:39:09
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
2010-09-13 19:51:07