Skip to main content

Read/Write metadata of digital image, including EXIF, IPTC, XMP.

Reason this release was yanked:

Hide the old version on pypi. If you insist, download it from https://github.com/LeoHsiao1/pyexiv2/releases

Project description

pyexiv2

Read/Write metadata of digital image, including EXIF, IPTC, XMP.

Features

Usage

  • read metadata :

    >>> from pyexiv2 import Image
    >>> i = Image("tests/1.jpg")
    >>> i.read_exif()
    {'Exif.Image.DateTime': '2019:06:23 19:45:17', 'Exif.Image.Artist': 'TEST', 'Exif.Image.Rating': '4', ...}
    >>> i.read_iptc()
    {'Iptc.Envelope.CharacterSet': '\x1b%G', 'Iptc.Application2.ObjectName': 'TEST', 'Iptc.Application2.Keywords': 'TEST', ...}
    >>> i.read_xmp()
    {'Xmp.dc.format': 'image/jpeg', 'Xmp.dc.rights': 'lang="x-default" TEST', 'Xmp.dc.subject': 'TEST', ...}
    
  • modify metadata :

    >>> # prepare the XMP data you want to modify
    >>> _dict = {"Xmp.xmp.CreateDate": "2019-06-23T19:45:17.834",   # this will overwrite its original value, or add it if it doesn't exist
    ...          "Xmp.xmp.Rating": ""}  # set an empty str explicitly to delete the datum
    >>> i.modify_xmp(_dict)
    >>> # check the result
    >>> xmp_dict = i.read_xmp()
    >>> xmp_dict["Xmp.xmp.CreateDate"]
    '2019-06-23T19:45:17.834'           # it has been set
    >>> xmp_dict["Xmp.xmp.Rating"]
    KeyError: 'Xmp.xmp.Rating'          # it has been deleted
    
    • Use i.modify_exif() and i.modify_iptc() in the same way.
  • In short, please call the public methods of class pyexiv2.Image :

    i = Image("tests/1.jpg")
    i.read_exif()
    i.read_iptc()
    i.read_xmp()
    i.read_all()
    i.modify_exif({"Exif.Image.ImageDescription": "test",...})
    i.modify_iptc({"Iptc.Application2.ObjectName": "test",...})
    i.modify_xmp({"Xmp.xmp.CreateDate": "2019-06-23T19:45:17.834",...})
    i.modify_all({"EXIF":{...}, "IPTC":{...}, "XMP":{...}})
    i.clear_exif()
    i.clear_iptc()
    i.clear_xmp()
    i.clear_all()
    
  • More Details

Tests

There are some test cases in folder "pyexiv2/tests". Run them by pytest:

pip install pytest psutil
pytest -v

Project details


Release history Release notifications | RSS feed

Download files

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

Source Distribution

pyexiv2-1.2.3.tar.gz (2.1 MB view details)

Uploaded Source

Built Distribution

pyexiv2-1.2.3-py3-none-any.whl (2.1 MB view details)

Uploaded Python 3

File details

Details for the file pyexiv2-1.2.3.tar.gz.

File metadata

  • Download URL: pyexiv2-1.2.3.tar.gz
  • Upload date:
  • Size: 2.1 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.3

File hashes

Hashes for pyexiv2-1.2.3.tar.gz
Algorithm Hash digest
SHA256 3b59308f81de0c1ea7fd1736a7ba595b137b2cac258b25a0d5dc3b0ee40a51f4
MD5 a5aae8f99e643cf36f4b49a93def398c
BLAKE2b-256 e93853de9de3321be2a3c5cccef37c085bb2e735f55ebd5dfa8e4215be6c55e0

See more details on using hashes here.

File details

Details for the file pyexiv2-1.2.3-py3-none-any.whl.

File metadata

  • Download URL: pyexiv2-1.2.3-py3-none-any.whl
  • Upload date:
  • Size: 2.1 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.3

File hashes

Hashes for pyexiv2-1.2.3-py3-none-any.whl
Algorithm Hash digest
SHA256 f8ee4145d622bd643b6477cb9430fbe5a445236989db6ca23a8835e649d1a51d
MD5 e20c290a0145b872eb0356e98540c637
BLAKE2b-256 31b8b8036187e36a74223a0da00f285941b0e0be4f2a4226fd009702b5a3d804

See more details on using hashes here.

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