Skip to main content

Use native Core Graphics / ImageIO API on macOS to access and change image metadata

Project description

CGMetadata

Read and write image metadata on macOS from Python using the native ImageIO / Core Graphics frameworks.

CGMetadata is a Python wrapper around the macOS ImageIO and Core Graphics frameworks. It provides a simple interface for reading and writing image metadata, including EXIF, IPTC, and XMP data. Reading is supported for all image formats supported by ImageIO. Writing is not currently supported for RAW file formats.

Video formats are not currently supported.

Synopsis

>>> from cgmetadata import ImageMetadata
>>> md = ImageMetadata("tests/data/test.heic")
>>> md.exif["LensMake"]
'Apple'
>>> md.iptc["Keywords"]
(
    flower,
    plant,
    farm
)
>>> md.xmp["dc:description"]
['A sunflower plant']
>>> # write an XMP sidecar file for the image
>>> with open("test.xmp", "w") as f:
...     md.xmp_dump(f)
...

Installation

pip install cgmetadata

Usage

...

CLI

...

API Reference

...

Supported Versions

CGMetadata has been tested on macOS 13 (Ventura) but should work on macOS 11 (Big Sur) and later. It will not work on earlier versions of macOS due to the use of certain APIs that were introduced in macOS 11. It is compatible with Python 3.9 and later.

License

MIT License, copyright Rhet Turnbull, 2023.

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

cgmetadata-0.1.0.tar.gz (67.8 MB view hashes)

Uploaded Source

Built Distribution

cgmetadata-0.1.0-py3-none-any.whl (12.3 kB view hashes)

Uploaded Python 3

Supported by

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