JDK-6868109 : CMYK image support in 1.6.x fails when it works in 1.5.x
  • Type: Bug
  • Component: client-libs
  • Sub-Component: 2d
  • Affected Version: 6u14
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_xp
  • CPU: x86
  • Submitted: 2009-08-04
  • Updated: 2021-01-29
  • Resolved: 2021-01-29
Related Reports
Duplicate :  
Relates :  
Description
FULL PRODUCT VERSION :
any version of 1.5 works with the CMYK.pf and any version of 1.6 does not.
The converse is not true.  1.5 works well wiht the CMYK.pf solution but works very slowly with the other solution.

ADDITIONAL OS VERSION INFORMATION :
Windows XP

A DESCRIPTION OF THE PROBLEM :
I have a program which works in 1.5 and fails in 1.6.  It relates to the support of CMYK images and ICC_Profiles.  I have had to add the following code: (which sucks!)

ColorSpace cmykColorSpace;

         if (TpInfo.jvmString.compareTo("1.6") < 0) {
            InputStream is = tptiff.TIFFResources.class.getResourceAsStream("CMYK.pf");
            ICC_Profile outputProfile = ICC_Profile.getInstance(is);
            cmykColorSpace = new ICC_ColorSpace(outputProfile);
            }
         else {
            // ImageIO uses com.sun.media.jai.util.SimpleCMYKColorSpace when it reads
            // untagged CMYK files.  This require JAI, not good!
            //final ColorSpace cmykColorSpace = SimpleCMYKColorSpace.getInstance();
            //final ColorSpace cmykColorSpace = ColorSpace.getInstance(ColorSpace.TYPE_CMYK);

            // this uses a simple extended colorspace
            cmykColorSpace = new CMYKColorSpace();
            }

         ComponentColorModel colorModel = new ComponentColorModel(cmykColorSpace,
                                                                 new int[] { 8, 8, 8, 8 },
                                                                 false,
                                                                 false,
                                                                 Transparency.OPAQUE,
                                                                 DataBuffer.TYPE_BYTE);

         WritableRaster raster = colorModel.createCompatibleWritableRaster(tkn.hs,tkn.vs);
         BufferedImage  bImg = new BufferedImage(colorModel,raster,false,null);
         WritableRaster rst = bImg.getRaster();
         int bl = tkn.hs*tkn.vs;
         byte[] b = tkn.iData;
         rst.setDataElements(0,0,tkn.hs,tkn.vs,b);
         double xs = pageUnits()/tkn.hr;
         double ys = pageUnits()/tkn.vr;
         g.scale(xs,ys);
         AffineTransform atr = new AffineTransform();
         atr.setToIdentity();
         g.drawImage(bImg,atr,this);

The CMYK.pf file is the file found in the older version of JAI.  It is not acceptable to require JAI to get CMYK to work!

Clearly you broke something when you went to 1.6 

REPRODUCIBILITY :
This bug can be reproduced always.

Comments
Please re-open if - if fix is in progress or on the plan to fix soon - if this is a P3 (file as P3, not P4)
18-03-2014

EVALUATION Duplicate of 6793694? Should be fixed in 6u14 and later then.
29-09-2009

EVALUATION Likely to be caused by kernel installer that does not fetch .pf. I think this problem has been already reported (and may be should be already resolved?)
26-08-2009