tag on Exif PIL Python

在 Python 下讀 Exif 有好些種方法,我慣用的 PIL 也有一些未公開的方法可以支援:

#-*- coding: UTF-8 -*-

from glob import glob

import Image
from ExifTags import TAGS

files = glob(u"*.JPG")
im = Image.open(files[0])
rawexif = im._getexif()
exif = dict([(TAGS.get(k,0), rawexif[k]) for k in rawexif])
for k in sorted(exif.keys()):
    print k, exif[k]

不過不知道怎麼用 PIL 儲存修改過的 Exif。jpeg.py 可以儲存 exif,不過現在抓不下來。算了,我還不想自己刻。

Posted by yungyuc at 13:49, 0 comment, 0 trackback.
Change to page (10 entries in each page): 1
© hover year to navigate month: powered by django