Skip to main content

A Python interface to read and write Metadata Working Group fields using exiftool

Project description

EXIF Metadata Working Group Tool

PyPI - Version PyPI - Python Version codecov


Table of Contents

What

This library is a wrapper around PyExifTool to simplify the reading and writing of image metadata fields as defined by the Metadata Working Group. The specification Guidelines for Handling Image Metadata (PDF) defines a structured way to resolve certain common fields across the various versions and standards for image metadata.

Working with image metadata is challenging due to the multiple competing standards and implementation differences. This library abstracts away these complexities, providing a consistent interface for accessing and modifying metadata regardless of which standard is used in the image.

Features

  • Simplified Metadata Management: Directly links to Exiv2 to read or set the common MWG fields
  • Strongly Typed Interface: All functions, properties and returns are typed
  • Key Metadata Fields:
    • XMP-mwg-kw:KeywordInfo - Read and write hierarchical keyword/tag trees for images
    • XMP-mwg-rs:RegionInfo - Manage region annotations for images (face tagging, object recognition boxes)
    • MWG:Description - Access standardized image descriptions across metadata formats
    • Title - Manage image titles consistently
  • Extensive testing: Tested via both Python and C++ unit tests, with code coverage, including branch coverage information

Requirements

  • Python 3.9 or higher

Installation

pip install exifmwg

Usage

Quick Start

from pathlib import Path
from exifmwg import read_metadata
from exifmwg import write_metadata

# Read metadata from an image
metadata = read_metadata(Path("sample.jpg"))
# Print the image title
print(f"Image title: {metadata.Title}")

# Set a new title and description
metadata.Title = "Sunset at the Beach"
metadata.Description = "Beautiful sunset captured at Malibu Beach"
write_metadata(metadata)

Reading and Modifying Image Regions

from pathlib import Path
from exifmwg import read_metadata
from exifmwg import write_metadata

test_file = Path("sample.jpeg")

# Read metadata from image
metadata = tool.read_image_metadata(test_file)

# Print the defined regions and their type for an image
for region in metadata.RegionInfo.RegionList:
    print(f"Name: {region.Name}, Type: {region.Type}, Description: {region.Description or '(None)'}")

# Change the person's name in the first region
metadata.RegionInfo.RegionList[0].Name = "Billy Bob"
tool.write_image_metadata(metadata)

Example output:

Name: John Smith, Type: Face, Description: Family member
Name: Rover, Type: Pet, Description: Family dog

Working with Keyword Hierarchies

from pathlib import Path
from exifmwg import Keyword
from exifmwg import read_metadata
from exifmwg import write_metadata

test_file = Path("sample.jpeg")

metadata = read_metadata(test_file)

# Create a new keyword hierarchy
new_keyword = Keyword(
    Keyword="Vacation",
    Children=[
        models.Keyword(Keyword="Beach"),
        models.Keyword(Keyword="Mountain")
    ]
)

# Add to existing keywords
metadata.KeywordInfo.KeywordList.append(new_keyword)

# Write back to the image
write_metadata(metadata)

Documentation

For more detailed information about using this library, refer to:

Why

Although this could all be done directly with PyExifTool, using this wrapper provides several advantages:

  1. Strongly typed interface makes it easier to understand what fields are available
  2. Simplified API reduces the learning curve for managing image metadata
  3. Handles the complexity of different metadata standards and their implementations

License

exifmwg is distributed under the terms of the Mozilla Public License 2.0 license.

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

exifmwg-0.3.0.tar.gz (2.3 MB view details)

Uploaded Source

Built Distributions

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

exifmwg-0.3.0-cp313-cp313-win_amd64.whl (6.0 MB view details)

Uploaded CPython 3.13Windows x86-64

exifmwg-0.3.0-cp313-cp313-musllinux_1_2_x86_64.whl (4.4 MB view details)

Uploaded CPython 3.13musllinux: musl 1.2+ x86-64

exifmwg-0.3.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (3.9 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

exifmwg-0.3.0-cp312-cp312-win_amd64.whl (6.0 MB view details)

Uploaded CPython 3.12Windows x86-64

exifmwg-0.3.0-cp312-cp312-musllinux_1_2_x86_64.whl (4.4 MB view details)

Uploaded CPython 3.12musllinux: musl 1.2+ x86-64

exifmwg-0.3.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (3.9 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

exifmwg-0.3.0-cp311-cp311-win_amd64.whl (6.0 MB view details)

Uploaded CPython 3.11Windows x86-64

exifmwg-0.3.0-cp311-cp311-musllinux_1_2_x86_64.whl (4.4 MB view details)

Uploaded CPython 3.11musllinux: musl 1.2+ x86-64

exifmwg-0.3.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (3.9 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

exifmwg-0.3.0-cp310-cp310-win_amd64.whl (6.0 MB view details)

Uploaded CPython 3.10Windows x86-64

exifmwg-0.3.0-cp310-cp310-musllinux_1_2_x86_64.whl (4.4 MB view details)

Uploaded CPython 3.10musllinux: musl 1.2+ x86-64

exifmwg-0.3.0-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (3.9 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

exifmwg-0.3.0-cp39-cp39-win_amd64.whl (6.0 MB view details)

Uploaded CPython 3.9Windows x86-64

exifmwg-0.3.0-cp39-cp39-musllinux_1_2_x86_64.whl (4.4 MB view details)

Uploaded CPython 3.9musllinux: musl 1.2+ x86-64

exifmwg-0.3.0-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (3.9 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

File details

Details for the file exifmwg-0.3.0.tar.gz.

File metadata

  • Download URL: exifmwg-0.3.0.tar.gz
  • Upload date:
  • Size: 2.3 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for exifmwg-0.3.0.tar.gz
Algorithm Hash digest
SHA256 d3dda783f42d0cafd6bdd57e2a3d9425c6f4462dc6cd952728179a7c9f3f95c6
MD5 b47f5e172106b5a1f50aef7c6a5205f6
BLAKE2b-256 cf74f81012a47b4c22ff681f52dab47fe497ece3fc1841048cc2d9a524201c6e

See more details on using hashes here.

Provenance

The following attestation bundles were made for exifmwg-0.3.0.tar.gz:

Publisher: ci.yml on stumpylog/exifmwg

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file exifmwg-0.3.0-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: exifmwg-0.3.0-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 6.0 MB
  • Tags: CPython 3.13, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for exifmwg-0.3.0-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 99dbb741e5d1c0d9fb1a6a9e46f57d4041ffe9f139da3f030fcf5c3e6ba9160f
MD5 fde375bc6b11c7c48aaeaee343c0dd63
BLAKE2b-256 094aa399e3495aee6fa621fba8de60a70fa788ef083b35a0e1794e1405947f9e

See more details on using hashes here.

Provenance

The following attestation bundles were made for exifmwg-0.3.0-cp313-cp313-win_amd64.whl:

Publisher: ci.yml on stumpylog/exifmwg

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file exifmwg-0.3.0-cp313-cp313-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for exifmwg-0.3.0-cp313-cp313-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 1c7486a45b9c9e86e0d71ce071120435fe4018585b3e454d15c7ff24738ffe80
MD5 27b421dc7147c7719310f52120ae1fe8
BLAKE2b-256 47100653f8f53a18cc5c33774b28355cdc8346bb2827ba87914225d08d3d4a18

See more details on using hashes here.

Provenance

The following attestation bundles were made for exifmwg-0.3.0-cp313-cp313-musllinux_1_2_x86_64.whl:

Publisher: ci.yml on stumpylog/exifmwg

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file exifmwg-0.3.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for exifmwg-0.3.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 06747f4a55f25ef6025e7ca6b243654c0f2080f32471984988611a8a1fe5ada7
MD5 ed67e065bbf0edcbdd769d8e0ab19294
BLAKE2b-256 f2a50ed79ef7bc738d0a761399e6faf155becbf92e441091fa41b2c874e28f4d

See more details on using hashes here.

Provenance

The following attestation bundles were made for exifmwg-0.3.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: ci.yml on stumpylog/exifmwg

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file exifmwg-0.3.0-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: exifmwg-0.3.0-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 6.0 MB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for exifmwg-0.3.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 f0a346b4cd18ad020984a1e8e87dcae854f83ee31c77376603d340fac6f808be
MD5 6e99a18245acf4340bf644010efb632a
BLAKE2b-256 6711f64f425a0b5f5066058ec5f7ef455dbc6cdd988dd8f494ee829d232d7386

See more details on using hashes here.

Provenance

The following attestation bundles were made for exifmwg-0.3.0-cp312-cp312-win_amd64.whl:

Publisher: ci.yml on stumpylog/exifmwg

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file exifmwg-0.3.0-cp312-cp312-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for exifmwg-0.3.0-cp312-cp312-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 9321409a3e75affe64745d782a038b3d64fb430484981dd0b2591b80bdfb818b
MD5 c3c4a3e403c9fa148ce3d09611dca108
BLAKE2b-256 046f88cad21061a212fb7ae8ec9fccefefa6eb78d9a559a7923a5a3e841a02c4

See more details on using hashes here.

Provenance

The following attestation bundles were made for exifmwg-0.3.0-cp312-cp312-musllinux_1_2_x86_64.whl:

Publisher: ci.yml on stumpylog/exifmwg

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file exifmwg-0.3.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for exifmwg-0.3.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 50921a5c46a285ca7029b29dba2bf36cd48464ed169ca9a6f010cc0f81ad776e
MD5 e2d73c6fa076adaceec411cd6ffa06ce
BLAKE2b-256 a8752f307b47de3aef6f75cad3346507548e1ab08dc591a3b687b3f2926183bd

See more details on using hashes here.

Provenance

The following attestation bundles were made for exifmwg-0.3.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: ci.yml on stumpylog/exifmwg

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file exifmwg-0.3.0-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: exifmwg-0.3.0-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 6.0 MB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for exifmwg-0.3.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 19fda52bb8c2294176d89db4ed23a878869094506aff4ce83cbb3264db0c18ce
MD5 52f24989920f954dc869b57eb51ebcb7
BLAKE2b-256 e485a15d28383350b75b368237649da0e42109ce0a8fd6110038858eff5f55d4

See more details on using hashes here.

Provenance

The following attestation bundles were made for exifmwg-0.3.0-cp311-cp311-win_amd64.whl:

Publisher: ci.yml on stumpylog/exifmwg

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file exifmwg-0.3.0-cp311-cp311-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for exifmwg-0.3.0-cp311-cp311-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 2b8d3e62969cceb2d336508a1b9a2709adbedbd889432591eb29ade37be1b691
MD5 20a19fcd710bd73842d5dcf28363678e
BLAKE2b-256 2c6e9e6a368b5d7629d48e5c96cbde02e3ba74c1ba1e7e26e2bb7dc19e5f389f

See more details on using hashes here.

Provenance

The following attestation bundles were made for exifmwg-0.3.0-cp311-cp311-musllinux_1_2_x86_64.whl:

Publisher: ci.yml on stumpylog/exifmwg

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file exifmwg-0.3.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for exifmwg-0.3.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 7fe0f1de5852201b8d5ec97ccbbd5b663086eee90e570b12d7b78e88bcca5bcb
MD5 eb5bf693ede62cb851242df99b38ed8d
BLAKE2b-256 a7d7cb29cda17d11dc028957eebb336f0ee4c0d6eaf087f51e84c9e66497a03b

See more details on using hashes here.

Provenance

The following attestation bundles were made for exifmwg-0.3.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: ci.yml on stumpylog/exifmwg

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file exifmwg-0.3.0-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: exifmwg-0.3.0-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 6.0 MB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for exifmwg-0.3.0-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 b5929bd772acb776f47f293763d5b016613bdc656e5c46ab2afe79e8c3d7fef3
MD5 579f0e22ac6ab5c8c9e0d1ba0d48666f
BLAKE2b-256 428de4cd187795ac6e1ab56ee9f9648267059c6a37289cda8f89f287e41f4694

See more details on using hashes here.

Provenance

The following attestation bundles were made for exifmwg-0.3.0-cp310-cp310-win_amd64.whl:

Publisher: ci.yml on stumpylog/exifmwg

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file exifmwg-0.3.0-cp310-cp310-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for exifmwg-0.3.0-cp310-cp310-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 b7ddb6a1c7db2436a72e7cff90f4a2b7ebd311f6c15c6e21b028335b3c80931e
MD5 4986f1c89c3fcd75fa82a97006900b16
BLAKE2b-256 0fcf3045c1c36414907ecda9eb3bcab3d142947bde17ada50e586d92a0bf26e7

See more details on using hashes here.

Provenance

The following attestation bundles were made for exifmwg-0.3.0-cp310-cp310-musllinux_1_2_x86_64.whl:

Publisher: ci.yml on stumpylog/exifmwg

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file exifmwg-0.3.0-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for exifmwg-0.3.0-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 886b256ab24efb0d61fc27a3d5091b6ba569ac3da463b6b04d545fae7cf5bcb8
MD5 b46f2c3bc155cfa18c386e60d30a8e9d
BLAKE2b-256 a737006aaad910aac6f6005b4b2a97a767f5413fdce1a1078f8a8d5fa7648234

See more details on using hashes here.

Provenance

The following attestation bundles were made for exifmwg-0.3.0-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: ci.yml on stumpylog/exifmwg

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file exifmwg-0.3.0-cp39-cp39-win_amd64.whl.

File metadata

  • Download URL: exifmwg-0.3.0-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 6.0 MB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for exifmwg-0.3.0-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 aef19dae1e4499162b53bf79ada006d508ade96db7198307333d3a9b54b6cbb3
MD5 6a86dcad503409cff8409d9709b81ffa
BLAKE2b-256 44671b83afefd7d7b4327b52e19cfd762e132ca3d42b8d57d446423e6523e1b4

See more details on using hashes here.

Provenance

The following attestation bundles were made for exifmwg-0.3.0-cp39-cp39-win_amd64.whl:

Publisher: ci.yml on stumpylog/exifmwg

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file exifmwg-0.3.0-cp39-cp39-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for exifmwg-0.3.0-cp39-cp39-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 37bb421bb8f4fdc56cda0528e44de22a1a3c4a28e71697a6bef3039ebe9a0851
MD5 2ad0655611b4a93e7043bab8180714c1
BLAKE2b-256 a417fda975defe30b52c689e45a129ecbcad1bf08b6cac0073e5c53ea824e305

See more details on using hashes here.

Provenance

The following attestation bundles were made for exifmwg-0.3.0-cp39-cp39-musllinux_1_2_x86_64.whl:

Publisher: ci.yml on stumpylog/exifmwg

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file exifmwg-0.3.0-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for exifmwg-0.3.0-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 6e959bb318d091fa20e3cb76bf2d63e5310cc1db5fa0ade42ca4a828915558f8
MD5 2d5a6a9ec592e0b8d9999b7fa35604ba
BLAKE2b-256 bcdcefffed6d5d8cc1da60506db258e5a15977cf277208f870f74dca28301942

See more details on using hashes here.

Provenance

The following attestation bundles were made for exifmwg-0.3.0-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: ci.yml on stumpylog/exifmwg

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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