How to get Exif data from a jpeg file

Daniel Fetchinson fetchinson at googlemail.com
Sat May 16 16:02:13 EDT 2009


> I need to get the creation date from a jpeg file in Python.  Googling
> brought up a several references to apparently defunct modules.  The best
> way I have been able to find so far is something like this:
>
> from PIL import Image
> img = Image.open('img.jpg')
> exif_data = img._getexif()
> creation_date = exif_data[36867]
>
> Where 36867 is the exif tag for the creation date data (which I found by
> ooking at PIL.ExifTags.TAGS).  But this doesn't even seem to be
> documented in the PIL docs.  Is there a more natural way to do this?


Have you tried http://sourceforge.net/projects/exif-py/ ?

HTH,
Daniel

-- 
Psss, psss, put it down! - http://www.cafepress.com/putitdown



More information about the Python-list mailing list