[OpenJDK 2D-Dev] ColorConvertOp ignors the rendering of icc profiles

Kreiss, Thomas Thomas.Kreiss at ppimedia.de
Tue Dec 18 13:06:03 UTC 2018


because of the migration from Java 8 to 11 I found a different behavior of the
currently used colormanagement engine (LCMS). The rendering intent of the input 
profiles will be completely ignored. Every converted image or raster will be shown 
with the relative colorimetic intent and doesn't matter if the input profiles contains 
a different rendering intent. I think there is a problem in the integration
of the LCMS. If I set the favored rendering intent manually in a debugging session 
I get the desired result (i.g. the papercolor will be displayed).

As input I use the printing profile ISOnewspaper26v4.cc and sRGB as output profile.
I try to convert a CMYK Raster into a RGB Raster using the mentioned profiles above.

So I had a look at the code from ColorConvertOp.java (and see me comments):

public final WritableRaster filter (Raster src, WritableRaster dest)

from line 511:
            /* make the transform list */
            theTransforms = new ColorTransform [nProfiles];

            /* initialize transform get loop */
	   >>> At this point the inital rendering intent will be set <<<
	   >>> in my case this is ICC_Profile.icRelativeColorimetric <<<
			if (profileList[0].getProfileClass() == ICC_Profile.CLASS_OUTPUT) {
                                            /* if first profile is a printer
                                               render as colorimetric */
                renderState = ICC_Profile.icRelativeColorimetric;
            else {
                renderState = ICC_Profile.icPerceptual; /* render any other
                                                           class perceptually */

            whichTrans = ColorTransform.In;

            PCMM mdl = CMSManager.getModule();

            /* get the transforms from each profile */
            for (i1 = 0; i1 < nProfiles; i1++) {
                if (i1 == nProfiles -1) {         /* last profile? */
                    whichTrans = ColorTransform.Out; /* get output transform */
                else {  /* check for abstract profile */
                    if ((whichTrans == ColorTransform.Simulation) &&
                        (profileList[i1].getProfileClass () ==
                         ICC_Profile.CLASS_ABSTRACT)) {
                        renderState = ICC_Profile.icPerceptual;
                        whichTrans = ColorTransform.In;

		>>> if is set the renderState to ICC_Profile.icAbsoluteColorimetric (3)  <<<
		>>> in the first iteration of the loop I get the correct result.  <<<
                theTransforms[i1] = mdl.createTransform (
                    profileList[i1], renderState, whichTrans);

                /* get this profile's rendering intent to select transform
                   from next profile */
                renderState = getRenderingIntent(profileList[i1]);

                /* "middle" profiles use simulation transform */
                whichTrans = ColorTransform.Simulation;

            /* make the net transform */
            thisRasterTransform = mdl.createTransform(theTransforms);

Don't get me wrong, the original code works perfectly using the old KodakCMS 
implementation but is seems that the LCMS has to be served in a different way.
I think the current implementation is wrong has to changed but I don't know how to 
create a bug issue in the JDK Bug System.

Best regards, Thomas

More information about the 2d-dev mailing list