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.2.0.tar.gz (2.2 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.2.0-cp313-cp313-win_amd64.whl (6.0 MB view details)

Uploaded CPython 3.13Windows x86-64

exifmwg-0.2.0-cp313-cp313-musllinux_1_2_x86_64.whl (4.6 MB view details)

Uploaded CPython 3.13musllinux: musl 1.2+ x86-64

exifmwg-0.2.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (4.1 MB view details)

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

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

Uploaded CPython 3.12Windows x86-64

exifmwg-0.2.0-cp312-cp312-musllinux_1_2_x86_64.whl (4.6 MB view details)

Uploaded CPython 3.12musllinux: musl 1.2+ x86-64

exifmwg-0.2.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (4.1 MB view details)

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

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

Uploaded CPython 3.11Windows x86-64

exifmwg-0.2.0-cp311-cp311-musllinux_1_2_x86_64.whl (4.6 MB view details)

Uploaded CPython 3.11musllinux: musl 1.2+ x86-64

exifmwg-0.2.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (4.1 MB view details)

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

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

Uploaded CPython 3.10Windows x86-64

exifmwg-0.2.0-cp310-cp310-musllinux_1_2_x86_64.whl (4.6 MB view details)

Uploaded CPython 3.10musllinux: musl 1.2+ x86-64

exifmwg-0.2.0-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (4.1 MB view details)

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

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

Uploaded CPython 3.9Windows x86-64

exifmwg-0.2.0-cp39-cp39-musllinux_1_2_x86_64.whl (4.6 MB view details)

Uploaded CPython 3.9musllinux: musl 1.2+ x86-64

exifmwg-0.2.0-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (4.1 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.2.0.tar.gz.

File metadata

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

File hashes

Hashes for exifmwg-0.2.0.tar.gz
Algorithm Hash digest
SHA256 158dbd31d1d4ff935f699f4d9250323c6360b89420d50ba6a4c05a16a9ed87e3
MD5 8e17e04c92acbb580999b0012f8f941a
BLAKE2b-256 55f1c76bfaeedb4062c638d8e80fbf194a495119766b9fef718bb61cc8d3b808

See more details on using hashes here.

Provenance

The following attestation bundles were made for exifmwg-0.2.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.2.0-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: exifmwg-0.2.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.2.0-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 58efc43a5013f8ba9e4d52d2a26ce3279b3b137ff61293243f5de20b56966542
MD5 b32a1dedf70aeae33a3492dbe7acada7
BLAKE2b-256 a059c311e631ac124632fac157cac8823a99df98ad867b044134aa71f51400e2

See more details on using hashes here.

Provenance

The following attestation bundles were made for exifmwg-0.2.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.2.0-cp313-cp313-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for exifmwg-0.2.0-cp313-cp313-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 38bbb7a0bdcecabcb96d8e5b7758c1f7939b1c650c849209eefe5a52ef16152f
MD5 e6cef8d9bc940c3b4437ba81e27156fc
BLAKE2b-256 d47a0586b94f2afc33a8783d80d31f825aa8413ce78520f9f5d000c0089fe083

See more details on using hashes here.

Provenance

The following attestation bundles were made for exifmwg-0.2.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.2.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for exifmwg-0.2.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 e12abc4d55e5724bccae8ab4cfddd61a86be6dc79bfed9a8ad01269c57075320
MD5 dcb7003b8ce1362d0e09a1ecb3715740
BLAKE2b-256 64f8995630bd616bf6b2a19f4e6328c03779970b0a73a36734e942c518ae361b

See more details on using hashes here.

Provenance

The following attestation bundles were made for exifmwg-0.2.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.2.0-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: exifmwg-0.2.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.2.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 89ad9ac0df2f6ef0429f957be3932de0267ae0fc413af32b7244a62b0f79a75d
MD5 96125224e2037ddf6d0571239e261c1c
BLAKE2b-256 91bcc9e133d91c5d0cfaec2dc19e4792da8d8aef8edeb8b678550bc10ce3ba75

See more details on using hashes here.

Provenance

The following attestation bundles were made for exifmwg-0.2.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.2.0-cp312-cp312-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for exifmwg-0.2.0-cp312-cp312-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 94d4996c1936caf87c3757d03da5acc13b5ff8d6671dd5e8a82ee4aa74e63402
MD5 45ba969c7e5756375129c739264f87f8
BLAKE2b-256 058ad8b373c815c92c3c3acdfc4e23b58bebeb45e0967d2b52eb358322d877a7

See more details on using hashes here.

Provenance

The following attestation bundles were made for exifmwg-0.2.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.2.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for exifmwg-0.2.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 e7f7985a4cdf3e686ccfc95d77110bff361d0ed571e83f236563cf27060b8b79
MD5 c97249231410f624b6dc0fdbeb270950
BLAKE2b-256 ace04ee6277e38a99c16ab330f4e96bf241a25767f6c22dec5b6c3cc22b7e6fd

See more details on using hashes here.

Provenance

The following attestation bundles were made for exifmwg-0.2.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.2.0-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: exifmwg-0.2.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.2.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 153fbcdd5e43197727a6a84c60eb49da47600255ca97f9d5ee7747142e6891f4
MD5 0db69cffdb1785c75760e222b0cfc407
BLAKE2b-256 13d6b1e22bd7fa5d0bfcab4025bd0c3c782bfb97434c1073660545dbe813f2ff

See more details on using hashes here.

Provenance

The following attestation bundles were made for exifmwg-0.2.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.2.0-cp311-cp311-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for exifmwg-0.2.0-cp311-cp311-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 7e92825ff49e9406769ab928d04830a33b2a5e27c845c55f3e37d3c0ccda510d
MD5 9b8f59152ffdc8b4e3fdfda7eb1575d4
BLAKE2b-256 f2f89f95af6bf6ae2dfc447361593ea9c00e75f3c3cb2003ac851285ecb06851

See more details on using hashes here.

Provenance

The following attestation bundles were made for exifmwg-0.2.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.2.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for exifmwg-0.2.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 e90e92528dd101daa0acc17056266f6591728d112d0d8e65f786867e5c11f04b
MD5 6527231d62872b7d423db346d8ab325b
BLAKE2b-256 4f7bb52c1ffe4357114ac9d6cf50a188d30941fe65f5e875df20a805905f2c85

See more details on using hashes here.

Provenance

The following attestation bundles were made for exifmwg-0.2.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.2.0-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: exifmwg-0.2.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.2.0-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 92db4f5e31154fc555c4c2ca3471580cf2db67a2f2113dfbb1b4dc3c4e6c3602
MD5 3c34fbf9187e96812515e14a51413cf6
BLAKE2b-256 4567090b3d6b99bb2fd7d00c9b5f2a3863460bf73726ce9224a7ad8f2fa48e37

See more details on using hashes here.

Provenance

The following attestation bundles were made for exifmwg-0.2.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.2.0-cp310-cp310-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for exifmwg-0.2.0-cp310-cp310-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 e14f5219c0a2058abcb11488d26bd6a6a69fdb61b9c795505d5cb5dc17558d09
MD5 62978df2671dd39e7baa6d32845f804f
BLAKE2b-256 d50dabddd00c01f25573441b826c1cb9239ce2dede54afbe767110c6029e80e9

See more details on using hashes here.

Provenance

The following attestation bundles were made for exifmwg-0.2.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.2.0-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for exifmwg-0.2.0-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 0416a95693d230b1a0780b8e3e48da6d7d6f35cbaaeed3bc0e6edea6a6c510f2
MD5 4f6030fcb3a6bdb24c0c1587975b4b14
BLAKE2b-256 0d98d4f9b77861bb506468a57731c0cc9aeb57c2fdb23810195f07de102f3fd7

See more details on using hashes here.

Provenance

The following attestation bundles were made for exifmwg-0.2.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.2.0-cp39-cp39-win_amd64.whl.

File metadata

  • Download URL: exifmwg-0.2.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.2.0-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 90dcedcf6592b07f3a34091a6111be9ebf87440cece3296ae54a46f16543ab96
MD5 ce2bedd24ba5094832e577ff6d26f6dd
BLAKE2b-256 c1edf6132ce13ead840e4f58a6fdfedde53dddfb4e5826c527374f0f3db579ae

See more details on using hashes here.

Provenance

The following attestation bundles were made for exifmwg-0.2.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.2.0-cp39-cp39-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for exifmwg-0.2.0-cp39-cp39-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 4f71ff58fed87cd1072972eca09cefc3c85cda51e4b7b65be75a80dba10be35f
MD5 ae95e69b02037be45f8a45545d514346
BLAKE2b-256 8f16bc03c931ff98d906ee1f5b79c360a9e03adfb9a7663e71ddb49e1fbd386f

See more details on using hashes here.

Provenance

The following attestation bundles were made for exifmwg-0.2.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.2.0-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for exifmwg-0.2.0-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 37560b373b557042d8b6efd9036b0ac17179af73bfc93b28abdc78b6537987f6
MD5 61dad00a3e2d717f60eb2105e64201e9
BLAKE2b-256 7ce68d9c565a9ff479a4e11b83bf287981c833d6ebc0705d8b7dacb85a4904c1

See more details on using hashes here.

Provenance

The following attestation bundles were made for exifmwg-0.2.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