Skip to main content
Inspiring
October 7, 2010
Question

cfimage or ImageRead problem

  • October 7, 2010
  • 2 replies
  • 2355 views

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

This topic has been closed for replies.

2 replies

May 12, 2011

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.

dave_jf
Participating Frequently
October 7, 2010

Progressive jpg?

--Dave

WestSideAuthor
Inspiring
October 7, 2010

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?

dave_jf
Participating Frequently
October 7, 2010

You can always use isImageFile to see if the file is a readable image.

--Dave