python - 使用 Python 检索图像描述(不通过 PIL 或 exifread 在 EXIF 数据中返回)

标签 python image exif

我想获取 .jpg 图像的描述。它显示在 Mac OSx 信息 (cmd +i) 窗口中。

Mac OS Info

我想阅读“描述”(德语为 Beschreibung)字段。用 PIL 和 exifread 尝试这个没有成功。

我可以获得这些 exif 标签,但它们不包含描述或关键字。

Key: Image ImageWidth
Key: Image ImageLength
Key: Image Compression
Key: Image Make
Key: Image Model
Key: Image XResolution
Key: Image YResolution
Key: Image PlanarConfiguration
Key: Image ResolutionUnit
Key: Image Software
Key: Image DateTime
Key: Image YCbCrPositioning
Key: Image ExifOffset
Key: Thumbnail Compression
Key: Thumbnail Orientation
Key: Thumbnail XResolution
Key: Thumbnail YResolution
Key: Thumbnail ResolutionUnit
Key: Thumbnail DateTime
Key: Thumbnail JPEGInterchangeFormat
Key: Thumbnail JPEGInterchangeFormatLength
Key: EXIF ExposureTime
Key: EXIF FNumber
Key: EXIF ExposureProgram
Key: EXIF ISOSpeedRatings
Key: EXIF SensitivityType
Key: EXIF ExifVersion
Key: EXIF DateTimeOriginal
Key: EXIF DateTimeDigitized
Key: EXIF ComponentsConfiguration
Key: EXIF ShutterSpeedValue
Key: EXIF ApertureValue
Key: EXIF ExposureBiasValue
Key: EXIF MaxApertureValue
Key: EXIF MeteringMode
Key: EXIF LightSource
Key: EXIF Flash
Key: EXIF FocalLength
Key: EXIF SubSecTimeOriginal
Key: EXIF SubSecTimeDigitized
Key: EXIF ColorSpace
Key: EXIF ExifImageWidth
Key: EXIF ExifImageLength
Key: EXIF FocalPlaneXResolution
Key: EXIF FocalPlaneYResolution
Key: EXIF FocalPlaneResolutionUnit
Key: EXIF SensingMethod
Key: EXIF FileSource
Key: EXIF SceneType
Key: EXIF CVAPattern
Key: EXIF CustomRendered
Key: EXIF ExposureMode
Key: EXIF WhiteBalance
Key: EXIF DigitalZoomRatio
Key: EXIF FocalLengthIn35mmFilm
Key: EXIF SceneCaptureType
Key: EXIF GainControl
Key: EXIF Contrast
Key: EXIF Saturation
Key: EXIF Sharpness
Key: EXIF SubjectDistanceRange
Key: EXIF BodySerialNumber
Key: EXIF LensSpecification
Key: EXIF LensModel

我假设这些字段不是 EXIF 数据?我需要寻找什么才能获得描述?

最佳答案

感谢@Mark Serchells 的回答,我发现描述不是EXIF 数据而是IPTC 数据(exiftool 显示所有字段)。

在 Python 中,我现在可以使用 IPTCInfo3:https://pypi.org/project/IPTCInfo3/并通过以下方式提取描述:

info = IPTCInfo('img.jpg')
info['caption/abstract']

打印:

b'Gel\xe4ndewagen auf den Salzformationen im Salzsee Ass-Ale in der Danakil-Senke, Danakil-Senke, Hamed Ela, Wollo, \xc4thiopien, Afrika

关于python - 使用 Python 检索图像描述(不通过 PIL 或 exifread 在 EXIF 数据中返回),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65550956/

相关文章:

python - SQLite 查询返回 false

javascript - 通过 ASIN 获取亚马逊产品图片

css - 将图像调整为 div 并将其居中

Javascript EXIF 图像方向和图像预览

c# - JpegBitmapEncoder.Save() 在使用元数据写入图像时抛出异常

ios - 快速访问 EXIF 字典

python - 动态加载两个 libpython 版本

python - 如何打印出 Python 函数需要/允许哪些参数?

python - 类从封闭范围获取 kwargs

java - 在java中将图像缩小到其高度和宽度的一半