Copy link to clipboard
Copied
Hi,
I have the following code:
<cfset img = ImageRead("test.jpg") />
<cfdump var="#img#" />
I get an error saying "Invalid image format".
java.awt.color.CMMException: Invalid image format
at sun.awt.color.CMM.checkStatus(CMM.java:131)
at sun.awt.color.ICC_Transform.<init>(ICC_Transform.java:89)
at java.awt.image.ColorConvertOp.filter(ColorConvertOp.java:516)
at com.sun.imageio.plugins.jpeg.JPEGImageReader.acceptPixels(JPEGImageReader.java:1102)
at com.sun.imageio.plugins.jpeg.JPEGImageReader.readImage(Native Method)
at com.sun.imageio.plugins.jpeg.JPEGImageReader.readInternal(JPEGImageReader.java:1070)
at com.sun.imageio.plugins.jpeg.JPEGImageReader.read(JPEGImageReader.java:885)
at javax.imageio.ImageReader.read(ImageReader.java:923)
at coldfusion.image.ImageReader.readJPEGImage(ImageReader.java:238)
at coldfusion.image.ImageReader.readJPEGImage(ImageReader.java:207)
at coldfusion.image.ImageReader.readImage(ImageReader.java:102)
at coldfusion.image.Image.<init>(Image.java:238)
Any idea why I'm getting this and how to fix it? The image is an actual image.
Westside
Copy link to clipboard
Copied
Progressive jpg?
--Dave
Copy link to clipboard
Copied
It must have been. I opened up the image in Fireworks and re-exported it as a jpg and it worked fine. Someone on our marketing team sent me this image. It had a .jpg extension but didn't work. Any idea why?
Copy link to clipboard
Copied
You can always use isImageFile to see if the file is a readable image.
--Dave
Copy link to clipboard
Copied
Its not to do with progressive JPG; image functions handle those just fine.
While I'm still uncertail as to the precise cause of the problem, this fix seems to be working for me:
http://zacster.blogspot.com/2010/12/cfimage-invalid-image-format-solution.html
<cffile action = "readbinary" file="d:\inetpub\wwwroot\test.jpeg" variable="tmpBin">
<cfimage action="READ" name="tmpImage" source="#tmpBin#">
Read the image as a binary then process the binary.