[Image-SIG] IOError: unable to identify image file(possibly weird EXIF data?)

Tim Hatch tim at timhatch.com
Thu Feb 12 19:17:55 CET 2009

> Does anyone know what might be going wrong here, or why PIL might be  
> having trouble with these images?

The issue with alexken.jpg appears to be slightly corrupt.  Photoshop  
CS3 complains "This file contains file info data which cannot be read  
and has been ignored." (but still loads the EXIF and some other  
info).  ImageMagick says "convert: Corrupt JPEG data: 22307 extraneous  
bytes before marker 0xe2" but still loads it.

001fd0: 06 00 00 00 00 00 07 00  06 00 00 00 01 01 00  
ff  ................
001fe0: e1 7d 1f 68 74 74 70 3a  2f 2f 6e 73 2e 61 64 6f  .}.http://ns.ado

ff e1 (broken across the line boundary) is a marker, 0x7d1f being its  
length.  Looking where that goes (position 0x9d00), the it's in the  
middle of a giant block of spaces and newlines (PIL agrees with my  
math here).  The next thing that looks like a marker (ff e2) is at  
position 0xf423 (0x5723 too far).  From there the markers are  
consistent.  If you chop out that strange part, it works in PIL but  
Photoshop still complains.

I don't know what causes it but I notice that both of your bad images  
were saved from Photoshop 7 on Windows.


More information about the Image-SIG mailing list