首先要介绍的是 Python Imaging Library,使用方法如下:
复制代码 代码如下:
from PIL import Image
from PIL.ExifTags import TAGS
def get_exif_data(fname):
"""Get embedded EXIF data from image file."""
ret = {}
try:
img = Image.open(fname)
if hasattr( img, '_getexif' ):
exifinfo = img._getexif()
if exifinfo != None:
for tag, value in exifinfo.items():
decoded = TAGS.get(tag, tag)
ret[decoded] = value
except IOError:
print 'IOERROR ' + fname
return ret
if name == 'main':
fileName = 'C:/Users/Leyond/Desktop/IMG_20121122_153514.jpg'
exif = get_exif_data(fileName)
print exif
Copyright© 2013-2020
All Rights Reserved 京ICP备2023019179号-8