通过 python-xmp-toolkit 读取图片xmlp信息

时间:2022-06-21 16:50:23
这个模块使用很简单,下面是示例:

file_name = '/path/to/xxx.JPG'

from libxmp import XMPFiles, consts
xmpfile = XMPFiles(file_path=file_name, open_forupdate=True)
xmp = xmpfile.get_xmp() print(xmp.get_property("http://www.dji.com/drone-dji/1.0/", 'SelfData'))
print(xmp.does_property_exist('http://www.dji.com/drone-dji/1.0/', 'SelfData'))
print(xmp)
print(xmp.get_array_item('http://ns.adobe.com/exif/1.0/', 'ComponentsConfiguration',4))
print(xmp.count_array_items('http://ns.adobe.com/exif/1.0/', 'ComponentsConfiguration'))
print(xmp.get_property_datetime('http://ns.adobe.com/photoshop/1.0/', 'DateCreated'))
print(xmp.get_namespace_for_prefix('drone-dji'))