swarmauri_xmp_jpeg
swarmauri_xmp_jpeg ships the JPEGXMP handler for embedding, reading, and removing XMP packets from JPEGs via APP1 segments that follow Adobe's namespace header.
Features
- Immediate discovery – derives from
EmbedXmpBaseso dynamic registry consumers can import it automatically. - Header accuracy – produces APP1 payloads prefixed with
http://ns.adobe.com/xap/1.0/\x00as required by the specification. - Defensive parsing – iterates markers safely and halts at SOS to avoid corrupting scan data.
Installation
# pip
pip install swarmauri_xmp_jpeg
# uv
uv add swarmauri_xmp_jpeg
Usage
from pathlib import Path
from swarmauri_xmp_jpeg import JPEGXMP
handler = JPEGXMP()
photo_path = Path("example.jpg")
xmp_packet = """<x:xmpmeta xmlns:x='adobe:ns:meta/'><rdf:RDF>...</rdf:RDF></x:xmpmeta>"""
# Insert the packet right after the SOI marker
updated_bytes = handler.write_xmp(photo_path.read_bytes(), xmp_packet)
photo_path.write_bytes(updated_bytes)
# Confirm it can be recovered later
restored_xml = handler.read_xmp(updated_bytes)
print(restored_xml)
# Strip the packet if needed
clean_bytes = handler.remove_xmp(updated_bytes)
Why it works
- APP1 discipline – the implementation builds a compliant APP1 segment with the canonical XMP namespace string.
- Dynamic registration – inheriting from
EmbedXmpBasemeans the handler is registered automatically for plugin discovery. - Robust parsing – helper iterators validate segment structure, stopping safely at SOS or malformed markers.
Project Resources
- Source: https://github.com/swarmauri/swarmauri-sdk
- License: Apache 2.0
Metadata
Release files for swarmauri_xmp_jpeg 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| swarmauri_xmp_jpeg-0.1.1.tar.gz | 3.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| swarmauri_xmp_jpeg-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 7.3 kB
Release files / swarmauri_xmp_jpeg-0.1.1.tar.gz
| Download URL | swarmauri_xmp_jpeg-0.1.1.tar.gz |
|---|---|
| Size | 3.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
630b418ac43d416f4b6c179264ea5c83d0e44798dc1db83edc0ec34f66bc419e
|
|
BLAKE2b-256 checksum How to use checksums |
8409b9857ee5775f639ae6c196389ad8f05015b8334b91a08943bc8a397656c3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.0 {"installer":{"name":"uv","version":"0.11.0","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}
|
Release files / swarmauri_xmp_jpeg-0.1.1-py3-none-any.whl
| Download URL | swarmauri_xmp_jpeg-0.1.1-py3-none-any.whl |
|---|---|
| Size | 4.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
cea527465afde0e0cdf3551fb802893fe366fd849274b6b4052cb0cb7c267872
|
|
BLAKE2b-256 checksum How to use checksums |
712ad9372d94871156637dba2a38ea9fd30b64fbb3072eff954bb0bef8b65458
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.0 {"installer":{"name":"uv","version":"0.11.0","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}
|