Page 1 of 1

Some JPEGs Are Broken in IE7

Posted: 2012-01-06T17:15:29-07:00
by adambuckley
Hi All,

I’m using ImageMagick 6.7.4 on 64-bit Windows Server 2003. It’s part of an image import process, which resizes hi-res JPEGs into thumbnails.

I have noticed that a subset of the original hi-res images don’t display in IE7 or IE8. They do display in other browsers, and they also display in Windows Explorer (as thumbnails) and Windows Picture and Fax Viewer (i.e. double click an image file in Windows XP). I think the problem is something to do with fancy JPEG metadata or suchlike, as these images are coming from photo studios. identify.exe tells me that some images use TIFF or PNG internally, even though the file has a .jpg extension.

My problem is that the thumbnails generated from these problematic JPEGs also don’t display in IE7 or IE8, but they do display everywhere else.

I therefore conclude that convert.exe is faithfully reproducing the metadata (or whatever) which causes IE7 to bomb out.

I’ve also noticed that some of the generated 70x70 thumbnails are greater than 500k in size - one is even greater than 1MB.

My manual solution is to do a screen capture while the image is being shown in Windows Picture and Fax Viewer and save that as a PNG. The generated thumbnail works fine in IE7.

So my question is: Can convert.exe be instructed to throw away the metadata when writing a JPEG? Or alternatively, can ImageMagick somehow automate the process of ‘taking a screenshot’ and producing a thumbnail from that?

FYI, I have also tried using jhead.exe to remove all metadata from the hi-res images. Some of the images change colour, and the thumbnails *still* don’t show in IE7.

Many thanks in advance, Adam.

Re: Some JPEGs Are Broken in IE7

Posted: 2012-01-06T17:30:10-07:00
by adambuckley
Hi, I've posted some examples which might assist.

http://adambuckley.net/ImageMagick/
  • original.jpg - hi-res image - won't display in IE7
  • thumbnail.jpg - thumbnail generated by ImageMagick - also won't display in IE7
  • huge_thumbnail1.jpg and huge_thumbnail2.jpg - examples of 70x70 jpeg images which have a huge file size.
Thumbnails are generated like this:

Code: Select all

convert.exe original.jpg -resize 70x70 output\thumbnail.jpg
Thanks again... Adam.

Re: Some JPEGs Are Broken in IE7

Posted: 2012-01-06T18:24:00-07:00
by fmw42
Some browsers will not display correctly jpgs that are cmyk as is your original. Try converting it to RGB with -colorspace or better -profiles.

convert original.jpg -colorspace RGB original_cmyk.jpg

or see
http://www.imagemagick.org/Usage/formats/#profiles

If you want to remove meta data see -strip
http://www.imagemagick.org/script/comma ... 4343#strip
http://www.imagemagick.org/Usage/thumbnails/#profiles

Re: Some JPEGs Are Broken in IE7

Posted: 2012-01-06T18:39:24-07:00
by adambuckley
Ha! They were CMYK images and I used your -colorspace RGB directive to fix it!

Many thanks, Adam.

Re: Some JPEGs Are Broken in IE7

Posted: 2012-01-06T19:07:30-07:00
by adambuckley
I found that this form produces the smallest thumbnail filesize.

Code: Select all

convert.exe original.jpg[70x70] -colorspace RGB -strip thumbnail.jpg

Re: Some JPEGs Are Broken in IE7

Posted: 2012-01-06T19:36:50-07:00
by fmw42
you could try

convert original.jpg -colorspace RGB -strip -thumbnail 70x70 thumbnail.jpg

see -thumbnail

http://www.imagemagick.org/script/comma ... #thumbnail

Re: Some JPEGs Are Broken in IE7

Posted: 2012-02-10T07:10:29-07:00
by NicolasRobidoux
An automated but non-ImageMagick solution: http://libvips.blogspot.com/2011/12/tas ... nvert.html