pyexiv2
raw JSON → 2.15.5 verified Sat May 09 auth: no python
A Python binding to exiv2 library for reading and writing image metadata (EXIF, IPTC, XMP, ICC Profile). Current version 2.15.5 supports Python 3.8+ and includes prebuilt wheels for Linux, macOS, and Windows. Releases follow exiv2 updates; active development.
pip install pyexiv2 Common errors
error ImportError: cannot import name 'Image' from 'pyexiv2' ↓
cause Package not installed or wrong Python version.
fix
pip install pyexiv2 (requires Python >=3.8)
error segmentation fault (core dumped) ↓
cause Image object not closed properly, causing C library to crash.
fix
Always call img.close() or use a context manager: with Image(path) as img:
error AttributeError: module 'pyexiv2' has no attribute 'pyexiv2' ↓
cause Incorrect import statement.
fix
Use 'from pyexiv2 import Image' instead of 'import pyexiv2' and then pyexiv2.pyexiv2.
Warnings
deprecated ImageMetadata() class is deprecated since v2.14.0. Use Image() instead. ↓
fix Replace ImageMetadata with Image.
deprecated enableBMFF() function is deprecated and no longer needed. BMFF support is always enabled. ↓
fix Remove any calls to enableBMFF().
gotcha Always call close() on Image objects to release resources and avoid segmentation faults. ↓
fix Use img = Image(path); ...; img.close(), or use context manager with Image(path) as img:
gotcha modify_exif() may produce duplicate EXIF keys when writing the same tag multiple times. Use modify_exif() with duplicate keys carefully. ↓
fix Ensure input dict values are unique per tag or handle duplicates explicitly.
Imports
- Image wrong
from pyexiv2 import pyexiv2correctfrom pyexiv2 import Image - ImageMetadata wrong
from pyexiv2 import Imagecorrectfrom pyexiv2 import ImageMetadata
Quickstart
from pyexiv2 import Image
img = Image('test.jpg')
img.read_exif()
# {'Exif.Image.Make': 'Canon', ...}
img.close()