I have been using ColorConvertOp to convert grayscale images in Java but have noticed that sometimes they end up loosing a lot of the mid tone colors and look darker than they should. I looked into it and discovered that Photoshop uses Black Point Compensation (BPC) to compensate for this issue. I found an article for BPC here but it's a little technical for me. Does Java support this natively using rendering intents or something, or am I going to have to figure out how to implement the algorithm explained in the document? I understand BPC happens because the absolute blacks are different colors within the color spaces but I need to use BPC to get the images looking the same. Any ideas?
I currently use the following code to convert to a new color space.
private void convertToColorSpace(ColorSpace colorSpace) {
RenderingHints hints = new RenderingHints(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
hints.put(RenderingHints.KEY_COLOR_RENDERING, RenderingHints.VALUE_COLOR_RENDER_QUALITY);
hints.put(RenderingHints.KEY_DITHERING, RenderingHints.VALUE_DITHER_ENABLE);
ColorConvertOp op = new ColorConvertOp(colorSpace, hints);
image = op.filter(image, null);
}
NOTE: ImageMagick is not an option, so please don't include it as an answer.
I have a solution mostly working based off of a black point compensation ISO draft, meaning it isn't standard yet, found here. The process, including variable names, and complete steps are very well defined. I couldn't find anything native to Java, though there is a Little CMS library written in c, which can probably be used with JNI.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With