如何使用python从图像中提取元数据?

编程入门 行业动态 更新时间:2024-10-28 01:25:29
本文介绍了如何使用python从图像中提取元数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

您好,我正在开发一个程序,该程序将打开图像,然后从图像中提取元数据 如何使用python提取元数据?

Hi im working on a program that will open an image and then extract the metadata from it How do i extract metadata using python ?

谢谢

推荐答案

使用Pillow,它是仍在积极开发中的PIL的分支,并且支持python3.在这里,我使用字典生成器将exif数据映射到字典

Use Pillow, it's a fork of PIL that is still in active development, and supports python3. Here I use a dict generator to map the exif data to a dict

from PIL import Image, ExifTags img = Image.open("/path/to/file.jpg") exif = { ExifTags.TAGS[k]: v for k, v in img._getexif().items() if k in ExifTags.TAGS }

更多推荐

如何使用python从图像中提取元数据?

本文发布于:2023-10-31 08:05:04,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1545516.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:如何使用   图像   数据   python

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!