Registry / serialization / python-xmp-toolkit

python-xmp-toolkit

JSON →
library2.1.0pypypi✓ verified 87d ago

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.

pip install python-xmp-toolkit
INSTALL
IMPORT
SIG · PYTHON-XMP-TOOLKIT
P
python-xmp-toolkit
serializationpythonv2.1.0
Install
1.7s avg
Import
53ms
Disk
19MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v2.1.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.910 runs
installs and imports cleanly · install 0.0s · import 0.051s · 20.8MB
glibc
py 3.103.910 runs
installs and imports cleanly · install 1.7s · import 0.055s · 21MB
19MB installed
● package 19MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

XMPFiles
from libxmp import XMPFiles
from xmp_toolkit import XMPFiles
The primary module name changed from `xmp_toolkit` to `libxmp` in version 2.0.0.
XMPMeta
from libxmp import XMPMeta
from xmp_toolkit import XMPMeta
The primary module name changed from `xmp_toolkit` to `libxmp` in version 2.0.0.
consts
from libxmp import consts
from xmp_toolkit import XMPConsts
The constants object was renamed from `XMPConsts` to `consts` and moved to the `libxmp` module in version 2.0.0.

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.

from libxmp import XMPMeta, consts # Create a new XMP metadata object xmp = XMPMeta() # Set properties in the Dublin Core namespace xmp.set_property(consts.NS_DC, "title", "My Awesome Photo") xmp.set_property(consts.NS_DC, "creator", "Jane Doe") # Add items to an array property (e.g., keywords) xmp.append_array_item(consts.NS_DC, "subject", "landscape", None, consts.XMP_ARRAY_LAST_ITEM) xmp.append_array_item(consts.NS_DC, "subject", "mountains", None, consts.XMP_ARRAY_LAST_ITEM) # Get a property title = xmp.get_property(consts.NS_DC, "title") print(f"Title: {title}") # Iterate over array items print("Subjects:") for i in range(xmp.count_array_items(consts.NS_DC, "subject")): # Array items are 1-indexed in XMP item = xmp.get_array_item(consts.NS_DC, "subject", i + 1) print(f"- {item}") # Serialize XMP to RDF/XML string rdf_string = xmp.dump_as_rdf() print("\n--- XMP as RDF ---") print(rdf_string) print("------------------")
Debug
Known issues
breakingVersion 2.0.0 introduced significant breaking changes, primarily renaming the main module from `xmp_toolkit` to `libxmp` and overhauling the API. Code written for 1.x will not work directly with 2.x.
fix
Update all imports from `xmp_toolkit` to `libxmp`. Review the new API for `XMPFiles`, `XMPMeta`, and constants (now `consts`) to adapt method calls.
affects: >=2.0.0
gotchaThis Python library requires the Exempi C++ library to be installed on your system. It is not bundled and will cause runtime errors if missing.
fix
Install `libexempi` (or `libexempi-dev`) via your system's package manager (e.g., `sudo apt-get install libexempi-dev` on Debian/Ubuntu, `brew install exempi` on macOS) before using `python-xmp-toolkit`.
affects: all
gotchaWhen working with `XMPFiles`, ensure the target file path exists and that your application has the necessary read/write permissions. Opening files for update (e.g., `open_for_update=True`) requires write access.
fix
Always use `try-except` blocks to handle `libxmp.exempi.ExempiError` when dealing with file operations. Verify file paths and permissions before attempting to open or modify XMP data.
affects: all
Errors
Common errors & fixes
ImportError: cannot import name 'XMPFiles' from 'xmp_toolkit'
Attempting to import from the old `xmp_toolkit` module after upgrading to version 2.0.0 or later.
fix
Change your import statements from `from xmp_toolkit import ...` to `from libxmp import ...`.
libxmp.exempi.ExempiError: Exempi library not found.
The underlying C++ Exempi library is not installed or not discoverable in your system's library paths.
fix
Install Exempi on your system. For Debian/Ubuntu: `sudo apt-get install libexempi-dev`. For macOS (Homebrew): `brew install exempi`. Ensure your system's dynamic linker can find the library.
libxmp.exempi.ExempiError: Could not open file (no such file or directory)
The file specified for `XMPFiles` does not exist, or the provided path is incorrect, or there are insufficient permissions to access it.
fix
Verify the file path is correct and the file exists. Check file permissions for read/write access depending on your operation. Use absolute paths where possible.
Upgrade
Version history
2.1.0latest on PyPI · released Nov 26, 2025
Audit
Dependencies
libexempirequiredThe underlying C++ library for XMP manipulation. Must be installed on the system (e.g., `sudo apt-get install libexempi` or `sudo apt-get install libexempi-dev` on Debian/Ubuntu, `brew install exempi` on macOS).
Agent activity
7 hits · last 30 days
node
6
Resources
python-xmp-toolkit — pip install python-xmp-toolkit · libregistry