JDK-6399616 : PIT:JPGReader throws exception when using TYPE_CUSTOM TypeSpecifier returned by Reader.getImageTypes
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.imageio
  • Affected Version: 6
  • Priority: P2
  • Status: Closed
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2006-03-16
  • Updated: 2011-01-19
  • Resolved: 2006-04-19
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 6
6 b81Fixed
Related Reports
Relates :  
Description
I am calling JPEGImageReader.getImageTypes and it returns a type specifier with the buffered image type '0' (TYPE_CUSTOM). I am creating a buffered image out of this image type specifier and setting it as destination when reading the image. But JPEGImageReader throws an IIOException on the PIT build and image is not read.

Here is the exception:
vax.imageio.IIOException: Incompatible color conversion
at com.sun.imageio.plugins.jpeg.JPEGImageReader.checkColorConversion(JPEGImageReader.java:816)
at com.sun.imageio.plugins.jpeg.JPEGImageReader.readInternal(JPEGImageReader.java:932)
at com.sun.imageio.plugins.jpeg.JPEGImageReader.read(JPEGImageReader.java:892)
at KannanImageIOTest.<init>(KannanImageIOTest.java:55)
at KannanImageIOTest.main(KannanImageIOTest.java:119)

This is reproducible only on the b77 PIT build and not reporducible on Mustang-b75. This exception is thrown on Solaris as well as Win32. Hence this is a regression introduced in Mustang. 

I have attached a sample test. Execute the sample test passing the image as a command line argument. If you see the above exception on the console, the bug is reproduced.

Comments
EVALUATION This regression caused by fix for 4705399 where we remove color conversion (JPEGImageReader.java lines 783 -786) because it causes extra color conversion for images with embedded color profile. However, this conversion is requires when destination type defines different color space for images that do not contain embedded profile. In this case we should convert image data from sRGB (produced by decoder) to color space used in destination image. The only exception is the case of present ICC profile - in this case conversion will be performed when image will be painted.
23-03-2006