It is necessary to determine whether the image is color or black and white. Standard tools (ColorModel, Color) give only a color mask.
I came to this decision, check the color difference and if it is more than 5 units, then I consider the image to be colored.
private boolean isColored(int pixel){ int red = (pixel >> 16) & 0xff; int green = (pixel >> 8) & 0xff; int blue = (pixel ) & 0xff; return Math.abs(red - green) > 5 || Math.abs(red - blue) > 5 || Math.abs(blue - green) > 5; } Maybe there are better options?