本文介绍了适用于python的Exif操作库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I'm looking for good exif (Exchangeable image file format) manipulation library for python. I prefer flexibility (e.g., ability to retrieve providers' proprietary tags) than processing speed. What would you suggest?

推荐答案

您可能想查看 exif- py :

Python映像库(PIL):

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

There's also the aptly named pyexif: http://pyexif.sourceforge.net/

但是,似乎pyexif已有一段时间没有更新了.他们建议如果他们的技巧不正确,不能签出EXIF-py,那么您可能应该首先尝试一下,因为他们的sourceforge页面最近似乎在其中有 some 活动,尽管数量不多.最后,使用PIL您可以执行以下操作:

However, it looks like pyexif hasn't been updated in quite while. They recommend if theirs isn't doing the trick to check out EXIF-py, so you should probably try that one first, as their sourceforge page seems to have some activity there lately, though not much. Finally, using PIL you could do this:

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

免责声明:
我实际上不知道哪个是最好的,这就是我与Google共同完成的工作. :)

Disclaimer:
I actually have no idea which is best, this is just what I was able to piece together with Google. :)

这篇关于适用于python的Exif操作库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-21 13:12