from libxmp import XMPFiles, XMPMeta, consts image = XMPFiles(file_path='1001.jpg', open_forupdate=True) xmp = image.get_xmp() xmp.register_namespace(consts.XMP_NS_CC, 'cc') xmp.set_property(consts.XMP_NS_CC, 'license', 'http://creativecommons.org/licenses/by-sa/4.0/') xmp.set_property(consts.XMP_NS_CC, 'attributionName', 'Max Mustermann') xmp.set_property(consts.XMP_NS_CC, 'attributionURL', 'http://example.com/bilder/1001.jpg') xmp.register_namespace(consts.XMP_NS_XMP_Rights, 'xmpRights') xmp.set_property_bool(consts.XMP_NS_XMP_Rights, 'Marked', True) usage = 'This work is licensed to the public under the Creative Commons Attribution-ShareAlike \ 4.0 International License' xmp.set_property(consts.XMP_NS_XMP_Rights, 'UsageTerms', usage) xmp.register_namespace(consts.XMP_NS_DC, 'dc') xmp.set_localized_text(consts.XMP_NS_DC, 'rights', '', 'x-default', usage) image.put_xmp(xmp) image.close_file()