[Image-SIG] EXIF tag reading fails for minimal tagged images

Fredrik Lundh fredrik at pythonware.com
Sat Apr 18 16:29:38 CEST 2009


On Sat, Apr 18, 2009 at 2:41 PM, Kurt Schwehr <schwehr at ccom.unh.edu> wrote:
> This is with python 2.6, pil 1.1.6 on mac osx 10.5.6 with fink python/pil
>
> wget
> http://schwehr.org/blog/attachments/2009-04/20090201-1601-with-exif-gps.jpeg
>
> ipython
> import Image
> im = Image.open('20090201-1601-with-exif-gps.jpeg')
>
> In [29]: im._getexif()
> ---------------------------------------------------------------------------
> KeyError                                  Traceback (most recent call last)
>
> /Users/schwehr/projects/src/healy/<ipython console> in <module>()
>
> /sw/lib/python2.6/site-packages/PIL/JpegImagePlugin.pyc in _getexif(self)
>   352             exif[key] = fixup(value)
>   353         # get exif extension
>
> --> 354         file.seek(exif[0x8769])
>   355         info = TiffImagePlugin.ImageFileDirectory(head)
>   356         info.load(file)
>
> KeyError: 34665

Thanks for the bug report.  The problem is that this file contains a
GPS IFD but not standard EXIF IFD.  The following fix is against
1.1.7b2, but the JpegImagePlugin part should work against 1.1.6 too:

http://hg.effbot.org/pil-2009-raclette/changeset/de084654231a/

</F>


More information about the Image-SIG mailing list