我需要按拍摄日期提取和组织照片。Windows 10,Python 2.7。我一直在这样做
from PIL import Image
def get_date_taken(path):
return Image.open(path)._getexif()[36867]
以下内容:
Get date and time when photo was taken from EXIF data using PIL
这对于一些照片来说非常有效。
但格言是完全不同的
Image.open(image)._getexif()[36867]
Traceback (most recent call last):
Debug Probe, prompt 369, line 1
KeyError: 36867
Image.open(image)._getexif()
{36864: '0220', 37121: '\x01\x02\x03\x00', 40962: 2048, 40963: 1536, 40960: '0100', 40961: 1, 296: 2, 34665: 90, 34855: 1600, 531: 2, 282: (72, 1), 283: (72, 1), 37500: '\x01\xf1\x03\x00\x03\x00\x00\x00\x11 ....
a=exifread.process_file(open(image,'rb'))
a.keys()
['EXIF MakerNote', 'Image ExifOffset', 'EXIF ExposureTime', 'EXIF ComponentsConfiguration', 'Image YCbCrPositioning', 'Image XResolution', 'EXIF FlashPixVersion', 'EXIF ISOSpeedRatings', 'Image YResolution', 'EXIF ColorSpace', 'EXIF ExifImageLength', 'EXIF ExifVersion', 'Image ResolutionUnit', 'EXIF ExifImageWidth']
"Date Taken" not showing up in Image PropertyItems while it shows in file details (file properties) in Windows Explorer
但是在python中。这个友好的在线元数据查看器
http://exif.regex.info/exif.cgi
建议两幅图像在exif中都有日期创建标签。如何访问它们?
示例有问题的图像是
here