How to get Exif data from a jpeg file

Arnaud Delobelle arnodel at googlemail.com
Sat May 16 06:48:52 EDT 2009


Hi all,

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?

Thanks.

-- 
Arnaud



More information about the Python-list mailing list