适用于python的Exif操作库 [英] Exif manipulation library for python

查看:77
本文介绍了适用于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库,用于从tiff和jpeg文件中提取EXIF数据.非常易于使用-$ ./EXIF.py image.jpg

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

Python映像库(PIL):

Python Imaging Library(PIL)为您的Python解释器添加了图像处理功能.该库支持多种文件格式,并提供强大的图像处理和图形功能.

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/

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

pyexif python库和工具旨在从包含它的Jpeg和Tiff文件中提取EXIF信息.此信息通常包含在使用数字成像设备(例如,数码相机,数字胶片扫描仪等)创建的图像中.

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页面最近似乎在其中有 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操作库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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