gpt4 book ai didi

python - 用于 python 的 Exif 操作库

转载 作者:IT老高 更新时间:2023-10-28 21:06:51 27 4
gpt4 key购买 nike

我正在为 python 寻找好的 exif(可交换图像文件格式)操作库。我更喜欢灵 active (例如,检索提供商专有标签的能力)而不是处理速度。你有什么建议?

最佳答案

您可能想查看 exif-py :

Python library to extract EXIF data from tiff and jpeg files. Very easy to use - $ ./EXIF.py image.jpg

Python Imaging Library (PIL) :

The Python Imaging Library (PIL) adds image processing capabilities to your Python interpreter. This library supports many file formats, and provides powerful image processing and graphics capabilities.

还有恰当命名的 pyexif:http://pyexif.sourceforge.net/

The pyexif python library and tools aims at extracting EXIF information from Jpeg and Tiff files which include it. This information is typically included in images created using digital imaging devices such as digital cameras, digital film scanners, etc.

但是,pyexif 似乎已经有一段时间没有更新了。他们建议如果他们没有做检查 EXIF-py 的技巧,所以你可能应该先尝试那个,因为他们的 sourceforge 页面最近似乎有 一些 事件,虽然不多。最后,使用 PIL 你可以这样做:

from PIL import Image
from PIL.ExifTags import TAGS

def get_exif(fn):
ret = {}
i = Image.open(fn)
info = i._getexif()
for tag, value in info.items():
decoded = TAGS.get(tag, tag)
ret[decoded] = value
return ret

免责声明:
我实际上不知道哪个是最好的,这正是我能够与谷歌拼凑而成的。 :)

关于python - 用于 python 的 Exif 操作库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/765396/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com