Package: exiv2
python-exiv2 is a low level interface (or binding) to theexiv2C++ library.
It is built usingSWIGto automatically generate the interface code.
The intention is to give direct access to all of the top-level classes inlibexiv2, but with additional “Pythonic” helpers where necessary.
Not everything in libexiv2 is available in the Python interface.
If you need something that’s not there, please let me know.NoteThis project has taken over the PyPI exiv2 package created by Michael Vanslembrouck.
If you need to use Michael’s project, it is available athttps://bitbucket.org/zmic/exiv2-python/src/master/and can be installed withpip:pip install exiv2==0.3.1ContentsIntroductionTransition to libexiv2 v0.28.xDocumentationSupport for bmff files (e.g. CR3, HEIF, HEIC, AVIF, JPEG XL)InstallationProblems?IntroductionThere are several other ways to accesslibexiv2from within Python.
The first one I used waspyexiv2 (old).
After its development ceased I moved on to usinggexiv2andPyGObject.
This works well, providing aMetadataobject with high level functions such asset_tag_stringandset_tag_multipleto get and set metadata values.A more recent development ispyexiv2 (new).
This new project is potentially very useful, providing a simple interface with functions to read and modify metadata using Pythondictparameters.For more complicated metadata operations I think a lower level interface is required, which is where this project comes in.
Here is an example of its use:Python3.6.12(default,Dec022020,09:44:23)[GCC]onlinuxType"help","copyright","credits"or"license"formoreinformation.>>>importexiv2>>>image=exiv2.ImageFactory.open('IMG_0211.JPG')>>>image.readMetadata()>>>data=image.exifData()>>>data['Exif.Image.Artist']._print()'Jim Easterbrook'>>>Please seeUSAGE.rstfor more help with using the Python interface to libexiv2.Transition to libexiv2 v0.28.xBefore python-exiv2 v0.16 the “binary wheels” available fromPyPIincorporated libexiv2 v0.27.7 or earlier.
Binary wheels for python-exiv2 v0.16.3 incorporate libexiv2 v0.28.2, and those for python-exiv2 v0.16.2 incorporate libexiv2 v0.27.7.
If your software is currently incompatible with libexiv2 v0.28.x you can use the older version of libexiv2 by explicitly installing python-exiv2 v0.16.2:$ pip install --user exiv2==0.16.2There are some changes in the libexiv2 API between v0.27.7 and v0.28.x.
Future versions of python-exiv2 will all incorporate libexiv2 v0.28.x, so please update your software to use the changed API.DocumentationThelibexiv2library is well documented for C++ users, inDoxygenformat.
Recent versions ofSWIGcan convert this documentation topydocformat in the Python interface:$ pydoc3 exiv2.Image.readMetadata
Help on method_descriptor in exiv2.Image:

exiv2.Image.readMetadata = readMetadata(...)
    Read all metadata supported by a specific image format from the
        image. Before this method is called, the image metadata will be
        cleared.

    This method returns success even if no metadata is found in the
    image. Callers must therefore check the size of individual metadata
    types before accessing the data.

    :raises: Error if opening or reading of the file fails or the image
            data is not valid (does not look like data of the specific image
            type).This is then converted to web pages bySphinxand hosted onReadTheDocs.Unfortunately some documentation gets lost in the manipulations needed to make a useful interface.
The C++ documentation is still needed in these cases.Support for bmff files (e.g. CR3, HEIF, HEIC, AVIF, JPEG XL)Python-exiv2 from version 0.8.3 onwards is built with support for BMFF files.
In order to use BMFF files in your Python program you need to call theenableBMFFfunction.
Please read the Exiv2statement on BMFFpatents before doing so.InstallationPython “binary wheels” are available for Windows, Linux, and MacOS.
These include the libexiv2 library and should not need any other software to be installed.
They can be installed with Python’spippackage.
For example, on Windows:C:\Users\Jim>pip install exiv2or on Linux or MacOS:$ pip3 install --user exiv2If the available wheels are not compatible with your operating system or Python version then pip will download the python-exiv2 source and attempt to compile it.
For more information, and details of how to compile python-exiv2 and libexiv2, seeINSTALL.rst.Problems?Please emailjim@jim-easterbrook.me.ukif you find any problems (or solutions!).