[Tutor] Obtaining image date of creation

Eric Abrahamsen eric at abrahamsen.com
Thu Nov 15 03:18:00 CET 2007


> And while I haven't tried it, this page (http://effbot.org/zone/pil-
> changes-114.htm) appears to indicate exif format is somewhat
> supported in PIL; perhaps pyexif does a better job though?

PIL does a pretty job, though it's a pain.

from PIL import Image
from PIL.ExifTags import TAGS
def get_exif(fn):
     ret = {}
     i = Image.open(fn)
     info = i._getexif()
     for tag, value in info.items():
         decoded = TAGS.get(tag, tag)
         ret[decoded] = value
     return ret

I found this here: http://wolfram.kriesing.de/blog/index.php/2006/ 
reading-out-exif-data-via-python


More information about the Tutor mailing list