用于python的Exif操作库

2024-04-16 22:29:36 发布

您现在位置:Python中文网/ 问答频道 /正文

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


Tags: 图像提供者能力标签建议exif灵活性处理速度
2条回答

您可能要签出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

免责声明
我真的不知道哪一个是最好的,这正是我能和谷歌拼凑起来的。:)

我最近一直在使用pyexiv2功能,它似乎非常适合我的需要。也许它也适合你的。

相关问题 更多 >