Skip to main content

pyxmp

A Python XMP metadata injection tool based on py3exiv2

Installation

python -m pip install git+https://github.com/numbersprotocol/pyxmp.git#egg=pyxmp

Usage

To inject XMP metadata to the image, the input metadata should be a list of dict following the format below, with provider, name and value as keys.

[
    {
        "provider": "InfoSnapshot",
        "name": "Brand",
        "value": "My Service"
    },
    {
        "provider": "InfoSnapshot",
        "name": "Current GPS Accuracy",
        "value": "14.589"
    },
    {
        "provider": "InfoSnapshot",
        "name": "Current GPS Latitude",
        "value": "25.045234"
    },
    {
        "provider": "InfoSnapshot",
        "name": "Current GPS Longitude",
        "value": "121.530795"
    },
    {
        "provider": "InfoSnapshot",
        "name": "Current GPS Timestamp",
        "value": "2020-09-15T13:50:25.143Z"
    },
    {
        "provider":"InfoSnapshot",
        "name":"Timestamp",
        "value":"2020-09-15T13:50:30.203Z"
    }
]

Then the metadata could be injected like the following example:

from pyxmp import pyxmp

metadata = {...} # Prepare the metadata like the above example

xmp_injected_image = pyxmp.inject(original_image_bytes, metadata, 'http://numbersprotocol.io/xmp/', 'examplePrefix')

To read the XMP metadata into a dict:

from pyxmp import pyxmp

metadata_dict = pyxmp.read(xmp_injected_image)

Example injected XMP metadata dict:

{
    'Xmp.examplePrefix.infoSnapshot.brand': 'My Service',
    'Xmp.examplePrefix.infoSnapshot.currentGPSAccuracy': '14.589',
    'Xmp.examplePrefix.infoSnapshot.currentGPSLatitude': '25.045234',
    'Xmp.examplePrefix.infoSnapshot.currentGPSLongitude': '121.530795',
    'Xmp.examplePrefix.infoSnapshot.currentGPSTimestamp': '2020-09-15T13:50:25.143Z',
    'Xmp.examplePrefix.infoSnapshot.timestamp': '2020-09-15T13:50:30.203Z'
}

Metadata

Release files for pyxmp 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for pyxmp 0.1.1
File Interpreter ABI Platform
pyxmp-0.1.1-py3-none-any.whl Python 3 none any Details

Release files / pyxmp-0.1.1-py3-none-any.whl

Download URL pyxmp-0.1.1-py3-none-any.whl
Size 15.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f658e45880111160eb5b31a0cd2b999b6af3b781e1833b2c8be2e45cd75f08d4
BLAKE2b-256 checksum
How to use checksums
763435381629d353b7584bc5b1e651caa42ef1e5c982ba1a0ac05157397ed058
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.6.0 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.8.5

Security for pyxmp 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Release history Release notifications | RSS feed

This release

0.1.1 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page