在 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. 
        
        
    
    
    
            Navigate
        
        - Previous: 把 Feedjack 和 Steno 黏在一起了 @2007/07/05
 - Next: Debian 的奇怪 mercurial 設定 @2007/07/27
 
            Add a trackback
        
        Please send trackback to: http://blog.seety.org/everydaywork/2007/7/13/692/trackback/.
            Add a comment
            
        
        
        
    
