PNG handler for embedding and extracting XMP packets in Swarmauri runtimes.
Project description
swarmauri_xmp_png
swarmauri_xmp_png packages the production-grade PNGXMP handler. It reads, writes, and removes XMP packets stored in uncompressed iTXt chunks that follow Adobe's keyword guidance, making it immediately compatible with downstream asset pipelines.
Features
- Registry-ready – inherits from
EmbedXmpBaseso Swarmauri's dynamic registry can auto-discover the handler. - Spec compliant – emits iTXt chunks with the
XML:com.adobe.xmpkeyword and UTF-8 payloads. - Safety guards –
_ensure_xmlperforms a minimal RDF/XML check before embedding metadata.
Installation
Choose the tool that matches your workflow:
# pip
pip install swarmauri_xmp_png
# uv
uv add swarmauri_xmp_png
Usage
from pathlib import Path
from swarmauri_xmp_png import PNGXMP
handler = PNGXMP()
image_path = Path("example.png")
xmp_packet = """<x:xmpmeta xmlns:x='adobe:ns:meta/'><rdf:RDF>...</rdf:RDF></x:xmpmeta>"""
# Embed an XMP packet
updated_bytes = handler.write_xmp(image_path.read_bytes(), xmp_packet)
image_path.write_bytes(updated_bytes)
# Verify the packet can be recovered
restored_xml = handler.read_xmp(updated_bytes)
print(restored_xml)
# Remove XMP if necessary
clean_bytes = handler.remove_xmp(updated_bytes)
Why it works
- Dynamic discovery – the handler is automatically registered with
DynamicBaseconsumers via inheritance. - Standards alignment – PNG metadata lives in an iTXt chunk per ISO 16684 guidance.
- Predictable behavior – read/write/remove flows mirror each other so pipelines remain idempotent.
Project Resources
- Source: https://github.com/swarmauri/swarmauri-sdk
- License: Apache 2.0
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file swarmauri_xmp_png-0.1.1.dev31.tar.gz.
File metadata
- Download URL: swarmauri_xmp_png-0.1.1.dev31.tar.gz
- Upload date:
- Size: 3.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.4 {"installer":{"name":"uv","version":"0.10.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
159a2f8758101d1f498fd84cf8f778537ed5aee196c7f33f6c6178ea3db49c5f
|
|
| MD5 |
267dcd31d71c34b0eb2c1c304e73c20f
|
|
| BLAKE2b-256 |
dcfc40e61042a29b1eac6ace858b978a8fa1ec804ad20d7a46c7093fd918aadc
|
File details
Details for the file swarmauri_xmp_png-0.1.1.dev31-py3-none-any.whl.
File metadata
- Download URL: swarmauri_xmp_png-0.1.1.dev31-py3-none-any.whl
- Upload date:
- Size: 4.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.4 {"installer":{"name":"uv","version":"0.10.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6de817b8d8ef7d1fe93c3cbffee5006d760da7c5b00a9fbe7235ae833c476df7
|
|
| MD5 |
0878cbcd27ca55d59b8ae96d7c906d70
|
|
| BLAKE2b-256 |
1e82156c923c7395f29bb8ef2951706b7558d5bbdf8b2b861c6d9880bbff4d54
|