使用PIL获取从EXIF数据拍摄照片的日期和时间 [英] Get date and time when photo was taken from EXIF data using PIL

查看:277
本文介绍了使用PIL获取从EXIF数据拍摄照片的日期和时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以获得EXIF使用PIL从图像中获取数据,但是如何获取照片的拍摄日期和时间?

I can get the EXIF data from an image using PIL, but how can I get the date and time that the photo was taken?

推荐答案

最终找到了答案,我需要的标签是

Found the answer eventually, the tag I needed was 36867:

from PIL import Image
def get_date_taken(path):
    return Image.open(path)._getexif()[36867]

这篇关于使用PIL获取从EXIF数据拍摄照片的日期和时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆