Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8216369

'ColorConvertOp ignores the rendering intent of icc profiles

    XMLWordPrintable

    Details

    • Subcomponent:
      2d
    • Introduced In Version:
      8
    • CPU:
      x86_64
    • OS:
      windows_10

      Description

      ADDITIONAL SYSTEM INFORMATION :
      Windows 10 , Java 8 and 11 using the build in LittleCMS (LSMS)

      A DESCRIPTION OF THE PROBLEM :
      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 a printing CMYK printing profile 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);
              }

      The original code works perfectly using the old KodakCMS (with Java 7 or Java 8)
      implementation but is seems that the LCMS has to be served in a different way.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1. Set the input profile (I use cmyk printing profile, with absolute colorimetric rendering intent)
      2. Set the output profile (i.e, sRGB )
      3. invoke method ColorConvertOp.filter(Raster src, WritableRaster dest) where src in a 4 banded cmyk raster
      4. display the image builded from dest

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      The resulting image should be shown with the absolute colorimetric rending intent.
      ACTUAL -
      The resulting image will always be be shown with the relative colorimetric rending intent.

      CUSTOMER SUBMITTED WORKAROUND :
      Use Java 8 setting the system property "sun.java2d.cmm" to "sun.java2d.cmm.kcms.KcmsServiceProvider"

      FREQUENCY : always


        Attachments

          Activity

            People

            • Assignee:
              prr Philip Race
              Reporter:
              webbuggrp Webbug Group
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated: