相关疑难解决方法(0)

Python EXIF找不到拍摄日期信息,但通过Windows属性查看时存在

我需要按拍摄日期提取和组织照片。Windows 10、Python 2.7。我一直在这样做

from PIL import Image
def get_date_taken(path):
    return Image.open(path)._getexif()[36867]
Run Code Online (Sandbox Code Playgroud)

下列的:

使用 PIL 从 EXIF 数据获取照片拍摄的日期和时间

这对于某些照片来说非常有用。

在此输入图像描述

伟大的。现在抓取一组不同的图像,新相机,属性看起来相似。

在此输入图像描述

但字典完全不同

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 ....
Run Code Online (Sandbox Code Playgroud)

我也尝试过exifread

a=exifread.process_file(open(image,'rb'))
a.keys()
['EXIF MakerNote', 'Image ExifOffset', 'EXIF ExposureTime', 'EXIF ComponentsConfiguration', 'Image YCbCrPositioning', 'Image XResolution', 'EXIF …
Run Code Online (Sandbox Code Playgroud)

python exif python-imaging-library

5
推荐指数
1
解决办法
5792
查看次数

标签 统计

exif ×1

python ×1

python-imaging-library ×1