Skip to main content

JPEG handler for embedding and extracting XMP packets in Swarmauri runtimes.

Project description

Swarmauri Logo

PyPI - Downloads Hits PyPI - Python Version PyPI - License PyPI - swarmauri_xmp_jpeg


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 EmbedXmpBase so dynamic registry consumers can import it automatically.
  • Header accuracy – produces APP1 payloads prefixed with http://ns.adobe.com/xap/1.0/\x00 as 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 EmbedXmpBase means the handler is registered automatically for plugin discovery.
  • Robust parsing – helper iterators validate segment structure, stopping safely at SOS or malformed markers.

Project Resources

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

swarmauri_xmp_jpeg-0.1.1.dev43.tar.gz (3.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

swarmauri_xmp_jpeg-0.1.1.dev43-py3-none-any.whl (4.2 kB view details)

Uploaded Python 3

File details

Details for the file swarmauri_xmp_jpeg-0.1.1.dev43.tar.gz.

File metadata

  • Download URL: swarmauri_xmp_jpeg-0.1.1.dev43.tar.gz
  • Upload date:
  • Size: 3.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.12 {"installer":{"name":"uv","version":"0.10.12","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

Hashes for swarmauri_xmp_jpeg-0.1.1.dev43.tar.gz
Algorithm Hash digest
SHA256 851579c5ddcfe5739c6bccd817df0f0a982e3047deb6ac28cd9c796f633b0339
MD5 07cc00aeb02048c3cc4e6d4b4489dfa3
BLAKE2b-256 c7cbbda87a6ea2f5028c83b09ab1cc503c89bee1491e15e17ee26cd9d9e6e7e2

See more details on using hashes here.

File details

Details for the file swarmauri_xmp_jpeg-0.1.1.dev43-py3-none-any.whl.

File metadata

  • Download URL: swarmauri_xmp_jpeg-0.1.1.dev43-py3-none-any.whl
  • Upload date:
  • Size: 4.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.12 {"installer":{"name":"uv","version":"0.10.12","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

Hashes for swarmauri_xmp_jpeg-0.1.1.dev43-py3-none-any.whl
Algorithm Hash digest
SHA256 c51758d9627e9bab94a3b45f320b07501488d69941e56ebc399079a2509524a8
MD5 a191239d62b8a2c03d32a0fadef5ef2a
BLAKE2b-256 b5111a54946e7c1ff9162503046e436303d6af9fca1ece5ffc5d54b1face699d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page