United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-7064516 ImageIO.read() fails to load an image
JDK-7064516 : ImageIO.read() fails to load an image

Details
Type:
Bug
Submit Date:
2011-07-08
Status:
Resolved
Updated Date:
2013-05-27
Project Name:
JDK
Resolved Date:
2012-11-28
Component:
client-libs
OS:
linux
Sub-Component:
2d
CPU:
x86
Priority:
P3
Resolution:
Fixed
Affected Versions:
6
Fixed Versions:

Related Reports

Sub Tasks

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
URL:   http://hg.openjdk.java.net/jdk8/2d/jdk/rev/934595726263
User:  bae
Date:  2012-11-28 10:19:12 +0000

                                     
2012-11-28
URL:   http://hg.openjdk.java.net/jdk8/jdk8/jdk/rev/934595726263
User:  lana
Date:  2012-12-11 19:52:58 +0000

                                     
2012-12-14



Hardware and Software, Engineered to Work Together