JDK-7064516 : ImageIO.read() fails to load an image
  • Type: Bug
  • Status: Resolved
  • Resolution: Fixed
  • Component: client-libs
  • Sub-Component: 2d
  • Priority: P3
  • Affected Version: 6
  • OS: linux
  • CPU: x86
  • Submit Date: 2011-07-08
  • Updated Date: 2013-05-27
  • Resolved Date: 2012-11-28
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 Availabitlity Release.

To download the current JDK release, click here.
JDK 8
8 b68Resolved
Description
FULL PRODUCT VERSION :
java version "1.6.0_24"
Java(TM) SE Runtime Environment (build 1.6.0_24-b07)
Java HotSpot(TM) 64-Bit Server VM (build 19.1-b02, mixed mode)


ADDITIONAL OS VERSION INFORMATION :
Fedora Linux 14 - Linux  2.6.35.13-92.fc14.x86_64

A DESCRIPTION OF THE PROBLEM :
Unexpected exception:
java.awt.color.CMMException: Invalid image format
	at sun.awt.color.CMM.checkStatus(CMM.java:131) ~[na:1.6.0_24]
	at sun.awt.color.ICC_Transform.<init>(ICC_Transform.java:89) ~[na:1.6.0_24]
	at java.awt.image.ColorConvertOp.filter(ColorConvertOp.java:516) ~[na:1.6.0_24]
	at com.sun.imageio.plugins.jpeg.JPEGImageReader.acceptPixels(JPEGImageReader.java:1169) ~[na:1.6.0_24]
	at com.sun.imageio.plugins.jpeg.JPEGImageReader.readImage(Native Method) ~[na:1.6.0_24]
	at com.sun.imageio.plugins.jpeg.JPEGImageReader.readInternal(JPEGImageReader.java:1137) ~[na:1.6.0_24]
	at com.sun.imageio.plugins.jpeg.JPEGImageReader.read(JPEGImageReader.java:948) ~[na:1.6.0_24]
	at javax.imageio.ImageIO.read(ImageIO.java:1422) ~[na:1.6.0_24]
	at javax.imageio.ImageIO.read(ImageIO.java:1326) ~[na:1.6.0_24]


STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
The problem is the same described here:
http://stackoverflow.com/questions/2999528/is-there-a-100-java-alternative-to-imageio-for-reading-jpeg-files
 and here:

http://forums.oracle.com/forums/thread.jspa?messageID=5357127&#5357127

I have a .jpg image file that causes the error.
(the same file can be opened in GIMP and the default GNOME image
viewer "Eye of gnome")
I can't find how to upload them here, please contact me.



REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
java.io.InputStream source = //here I loaded my file;
ImageIO.read(source);
---------- END SOURCE ----------

Comments
EVALUATION This problem is caused by a peculiarity of a color profile embedded into the image. In particular, the rendering intent field of the profile header is 0x10000, what does not conform the ICC spec. Section 7.2.15 demands that only 16 least-significant bits of the 32bit field shall be used to encode the rendering intent.The most significant 16 bits shall be set to zero. The kcms is not ready for such incorrect rendering intent, and reports profile format error. This behavior seems to be correct but too strict. We probably can a bit reduce it by ignoring the most significant 16 bits or rendering intent, and use only least-significant part of it.
2011-09-06