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

2009-04-18 Thread Fredrik Lundh
On Sat, Apr 18, 2009 at 2:41 PM, Kurt Schwehr  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/ in ()
>
> /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/


___
Image-SIG maillist  -  Image-SIG@python.org
http://mail.python.org/mailman/listinfo/image-sig


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

2009-04-18 Thread Kurt Schwehr

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/ in ()

/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

However, jhead works...

jhead 20090201-1601-with-exif-gps.jpeg
File name: 20090201-1601-with-exif-gps.jpeg
File size: 116441 bytes
File date: 2009:04:16 07:17:11
Resolution   : 1280 x 960
GPS Latitude : N 43d 12m 59.998s
GPS Longitude: W 123d  1m 12s
Comment  : Sun Feb 01 16:00:32 2009


___
Image-SIG maillist  -  Image-SIG@python.org
http://mail.python.org/mailman/listinfo/image-sig