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

The ColorConvertOp may break the used icc color profile

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P4
    • tbd
    • 8, 11, 16, 17
    • client-libs
    • None
    • 2d
    • generic
    • generic

    Description

      I trying to catch the reason of CMMException which are randomly thrown here and there.

      The ICC_ColorSpace may fail to access its data if this profile was used by the ColorConvertOp for color transformation.

      The test:
      import java.awt.color.ColorSpace;
      import java.awt.color.ICC_ColorSpace;
      import java.awt.image.BufferedImage;
      import java.awt.image.ColorConvertOp;

      import static java.awt.image.BufferedImage.TYPE_INT_RGB;

      public final class CannotGetProfile {

          public static void main(String[] args) throws Exception {
              ICC_ColorSpace from = (ICC_ColorSpace) ColorSpace.getInstance(ColorSpace.CS_PYCC);
              ICC_ColorSpace to = (ICC_ColorSpace) ColorSpace.getInstance(ColorSpace.CS_CIEXYZ);

              from.getProfile().getData();

              convert(from, to);

              from.getProfile().getData(); // CMMException!!!
          }

          private static void convert(ICC_ColorSpace from, ICC_ColorSpace to) {
              BufferedImage src = new BufferedImage(10, 10, TYPE_INT_RGB);
              BufferedImage dst = new BufferedImage(10, 10, TYPE_INT_RGB);
              ColorConvertOp op = new ColorConvertOp(from, to, null);
              op.filter(src, dst);
          }
      }

      The log:
      Exception in thread "main" java.awt.color.CMMException: Can not access specified profile.
      at java.desktop/sun.java2d.cmm.lcms.LCMS.getProfileDataNative(Native Method)
      at java.desktop/sun.java2d.cmm.lcms.LCMSProfile.getProfileData(LCMSProfile.java:52)
      at java.desktop/sun.java2d.cmm.lcms.LCMS.getProfileData(LCMS.java:80)
      at java.desktop/java.awt.color.ICC_Profile.getData(ICC_Profile.java:1085)
      at CannotGetProfile.main(CannotGetProfile.java:18)

      Attachments

        Activity

          People

            serb Sergey Bylokhov
            serb Sergey Bylokhov
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated: