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

Remove unnecessary / incorrect color conversions on painting images and shapes

XMLWordPrintable

    • 2d
    • x86_64
    • windows_10

      ADDITIONAL SYSTEM INFORMATION :
      Java 1.6 through Java 19, all operating systems, tested on Windows and Linux.

      A DESCRIPTION OF THE PROBLEM :
      When painting to a non-sRGB BufferedImage using a Graphics2D object from BufferedImage.createGraphics(), colors are converted and thereby mangled even when the source and destination color spaces are the same.

      For instance, if we create a BufferedImage that uses a CMYK color space created from an ICC_Profile object, and then fill the image with a Color object that uses the same Color spaces, the resulting colors in the image do not match the colors in the Color object. i.e. if the Color object is set to have values in the K component only, and no values in the C, M and Y components, the filled area colors will have values in all four CMYK components.

      From what we can see, it seems that Java converts the source CMYK colors to a different color space (don't know if it's sRGB or XYZ), and then converts that back to CMYK when applying to the image.

      This happens when filling areas or when painting a source image (that also uses the same CMYK color space) to the destination image.


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

              Created:
              Updated: