Registry / serialization / exif
library1.6.1pypypi✓ verified 90d ago

A Python library to read and modify image EXIF metadata with a simple, intuitive API. Current version 1.6.1 requires Python >=3.7. Releases are infrequent, but the library is stable and widely used.

pip install exif
INSTALL
IMPORT
SIG · EXIF
E
exif
serializationpythonv1.6.1
Install
1.6s avg
Import
133ms
Disk
17MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.9–3.13
musl
3.9–3.13
Install & Compatibility
Where this runs
tested against v1.6.1 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.10–3.95 runs
installs and imports cleanly · install 0.0s · import 0.138s · 18.7MB
glibc
py 3.10–3.95 runs
installs and imports cleanly · install 1.6s · import 0.128s · 19MB
17MB installed
● package 17MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Image
✓ from exif import Image
✗ import exif.Image
exif submodules are not directly importable; use the from syntax.

Open a JPEG file, read EXIF tags, and print common attributes.

from exif import Image with open('image.jpg', 'rb') as f: img = Image(f) if img.has_exif: print(f"Make: {img.make}") print(f"Model: {img.model}") print(f"Date/Time Original: {img.datetime_original}") else: print("No EXIF data found.")
Debug
Known issues
breakingVersion 1.0.0 changed from returning None to raising AttributeError when a tag does not exist. Accessing a tag not present in the image will raise an AttributeError, not return None.
fix
Use hasattr() or the tag's 'get' method (e.g., img.get('make', 'Unknown')).
affects: >=1.0.0
gotchaYou must open the image file in binary read mode ('rb'), not text mode. Opening in text mode will cause UnicodeDecodeError or corrupt EXIF parsing.
fix
Always use open('image.jpg', 'rb') when reading images with exif.
affects: all
gotchaWriting EXIF data requires the file to be opened in 'rb+' mode and the image to be seekable. Many users forget to open with write permission or close the file before writing.
fix
Open with 'rb+', modify tags, then call img.write() before closing.
affects: all
Errors
Common errors & fixes
AttributeError: 'Image' object has no attribute 'make'
The tag 'make' is not present in the EXIF data. The library raises AttributeError for missing tags since v1.0.0.
fix
Use getattr(img, 'make', 'Unknown') or the .get() method: img.get('make').
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 0: invalid start byte
The image was opened in text mode instead of binary mode.
fix
Open the file with open('image.jpg', 'rb') (binary read mode).
OSError: [Errno 9] Bad file descriptor
Trying to write EXIF data to a file opened in read-only mode ('rb') or after the file has been closed.
fix
Open with 'rb+' (read and write binary) and ensure the file is not closed before calling img.write().
Upgrade
Version history
1.6.1latest on PyPI · released Dec 10, 2024
Audit
Dependencies

No dependency data recorded yet.

Agent activity
14 hits · last 30 days
node
12
Resources
exif — pip install exif · libregistry