{"library":"python-xmp-toolkit","title":"Python XMP Toolkit","description":"Python XMP Toolkit (version 2.1.0) provides Python bindings for Adobe's XMP Toolkit SDK by wrapping the Exempi C++ library. It enables reading, writing, and manipulating XMP (Extensible Metadata Platform) metadata in various file formats (e.g., JPEG, TIFF, PDF). The library maintains an active release cadence, with recent updates focusing on stability and compatibility with newer Exempi versions.","language":"python","status":"active","last_verified":"Fri Apr 17","install":{"commands":["pip install python-xmp-toolkit"],"cli":null},"imports":["from libxmp import XMPFiles","from libxmp import XMPMeta","from libxmp import consts"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"from libxmp import XMPMeta, consts\n\n# Create a new XMP metadata object\nxmp = XMPMeta()\n\n# Set properties in the Dublin Core namespace\nxmp.set_property(consts.NS_DC, \"title\", \"My Awesome Photo\")\nxmp.set_property(consts.NS_DC, \"creator\", \"Jane Doe\")\n\n# Add items to an array property (e.g., keywords)\nxmp.append_array_item(consts.NS_DC, \"subject\", \"landscape\", None, consts.XMP_ARRAY_LAST_ITEM)\nxmp.append_array_item(consts.NS_DC, \"subject\", \"mountains\", None, consts.XMP_ARRAY_LAST_ITEM)\n\n# Get a property\ntitle = xmp.get_property(consts.NS_DC, \"title\")\nprint(f\"Title: {title}\")\n\n# Iterate over array items\nprint(\"Subjects:\")\nfor i in range(xmp.count_array_items(consts.NS_DC, \"subject\")):\n    # Array items are 1-indexed in XMP\n    item = xmp.get_array_item(consts.NS_DC, \"subject\", i + 1) \n    print(f\"- {item}\")\n\n# Serialize XMP to RDF/XML string\nrdf_string = xmp.dump_as_rdf()\nprint(\"\\n--- XMP as RDF ---\")\nprint(rdf_string)\nprint(\"------------------\")","lang":"python","description":"This quickstart demonstrates how to create, manipulate, and serialize XMP metadata using the `XMPMeta` class, which handles XMP data in memory. It covers setting properties, adding array items, retrieving values, and converting the XMP object to an RDF/XML string.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}