Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

cfimage or ImageRead problem

Engaged ,
Oct 07, 2010 Oct 07, 2010

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

TOPICS
Advanced techniques
2.3K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Oct 07, 2010 Oct 07, 2010

Progressive jpg?

--Dave

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Oct 07, 2010 Oct 07, 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?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Oct 07, 2010 Oct 07, 2010

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

--Dave

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
May 12, 2011 May 12, 2011
LATEST

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources