Skip to main content

Read and modify 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 and modify metadata of digital image, including EXIF, IPTC, XMP. It runs on C++ API of exiv2.

Features

  • Supported platforms: Linux 64bit, Windows 64bit
  • Works with Python3 (64bit)
  • Support for image paths and data that contain unicode characters.
  • Not thread-safe, because some global variables have been used in API.

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": ""}  # this will delete the datum in the image
    }
    
    >>> i.modify_xmp(_dict)
    >>> xmp_dict = i.read_xmp()         # read it again
    >>> 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
    
  • Metadata reference tables: https://www.exiv2.org/metadata.html

  • You may be interested in these metadata on Windows:

    {'Xmp.dc.title': 'lang="x-default" I am title',
    'Xmp.dc.subject': 'label1; label2; label3',
    'Xmp.MicrosoftPhoto.Rating':'75'}
    

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.1.0.tar.gz (2.1 MB view details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: pyexiv2-1.1.0.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.1.0.tar.gz
Algorithm Hash digest
SHA256 0b492d7382e97815281a47f3ee01708723bfef282e6cf7b03350bca1a5a24448
MD5 0f48360da5ba0f0d0b74dc7d736d75fa
BLAKE2b-256 2b0eeb47c364737313b691d8b7e89bbb314e8908145535c4cf03aac68f006b34

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pyexiv2-1.1.0-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.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 aac5f6b657cce0f8ae3798d3f574ebc6c9f698636a55b934f74b85e6c94f0a2d
MD5 bad65b78db5c95c8abdfd3279607ba57
BLAKE2b-256 94e3b1f82424183331497777760a133dd9025ee5cb7e467e02512a1f0d9346d4

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