Skip to main content

EXIF.py

https://pypip.in/v/ExifRead/badge.png https://pypip.in/d/ExifRead/badge.png https://travis-ci.org/ianare/exif-py.png

Easy to use Python module to extract Exif metadata from tiff and jpeg files.

Originally written by Gene Cash & Thierry Bousch.

Installation

PyPI

The recommended process is to install the PyPI package, as it allows easily staying up to date:

$ pip install exifread

See the pip documentation for more info.

Archive

Download an archive from the project’s releases page.

Extract and enjoy.

Compatibility

EXIF.py is tested on the following Python versions:

  • 2.6

  • 2.7

  • 3.2

  • 3.3

  • 3.4

Usage

Command line

$ EXIF.py image.jpg

Show command line options:

$ EXIF.py

Python Script

import exifread
# Open image file for reading (binary mode)
f = open(path_name, 'rb')

# Return Exif tags
tags = exifread.process_file(f)

Note: To use this library in your project as a Git submodule, you should:

from <submodule_folder> import exifread

Returned tags will be a dictionary mapping names of Exif tags to their values in the file named by path_name. You can process the tags as you wish. In particular, you can iterate through all the tags with:

for tag in tags.keys():
    if tag not in ('JPEGThumbnail', 'TIFFThumbnail', 'Filename', 'EXIF MakerNote'):
        print "Key: %s, value %s" % (tag, tags[tag])

An if statement is used to avoid printing out a few of the tags that tend to be long or boring.

The tags dictionary will include keys for all of the usual Exif tags, and will also include keys for Makernotes used by some cameras, for which we have a good specification.

Note that the dictionary keys are the IFD name followed by the tag name. For example:

'EXIF DateTimeOriginal', 'Image Orientation', 'MakerNote FocusMode'

Tag Descriptions

Tags are divided into these main categories:

  • Image: information related to the main image (IFD0 of the Exif data).

  • Thumbnail: information related to the thumbnail image, if present (IFD1 of the Exif data).

  • EXIF: Exif information (sub-IFD).

  • GPS: GPS information (sub-IFD).

  • Interoperability: Interoperability information (sub-IFD).

  • MakerNote: Manufacturer specific information. There are no official published references for these tags.

Processing Options

These options can be used both in command line mode and within a script.

Faster Processing

Don’t process makernote tags, don’t extract the thumbnail image (if any).

Pass the -q or --quick command line arguments, or as:

tags = exifread.process_file(f, details=False)

Stop at Given Tag

To stop processing the file after a specified tag is retrieved.

Pass the -t TAG or --stop-tag TAG argument, or as:

tags = exifread.process_file(f, stop_tag='TAG')

where TAG is a valid tag name, ex 'DateTimeOriginal'.

The two above options are useful to speed up processing of large numbers of files.

Strict Processing

Return an error on invalid tags instead of silently ignoring.

Pass the -s or --strict argument, or as:

tags = exifread.process_file(f, strict=True)

Contributing

All contributions are welcome!

Bug reports, feature requests, bug fixes, documentation updates, sample images, etc … Nothing is too small or too big ;-)

Please be aware that this is a purely spare time project, so don’t be offended if it takes some time to answer.

Code Contributions

Please start from the develop branch for any code or documentation contributions. You may even find the work has already been done…

Normally the master branch is only for stable, released code.

Sample Images

Sample images are very important, allowing for validating new features and limiting regressions. On every build, the library is run on all images.

The samples are kept in a separate repository for space and bandwidth concerns:

https://github.com/ianare/exif-samples

Metadata

Release files for ExifRead 2.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ExifRead 2.1.0
File Size Uploaded Provenance Actions
ExifRead-2.1.0.tar.gz 32.5 kB Without provenance Details for ExifRead-2.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for ExifRead 2.1.0
File Interpreter ABI Platform Actions
ExifRead-2.1.0-py2-none-any.whl Python 2 none any Details for ExifRead-2.1.0-py2-none-any.whl

Total release size: 67.0 kB

Release files / ExifRead-2.1.0.tar.gz

Download URL ExifRead-2.1.0.tar.gz
Size 32.5 kB
Tags Source
SHA-256 checksum
How to use checksums
903c88cbece98b8851c806a61a64a9d84f3d670348f67c0fdac68f0bc948206f
BLAKE2b-256 checksum
How to use checksums
e70c61b6d66e0c28974ec22f963dc1ed321a42a45422511b33d8ef8f27ce1acf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / ExifRead-2.1.0-py2-none-any.whl

Download URL ExifRead-2.1.0-py2-none-any.whl
Size 34.5 kB
Tags Python 2
SHA-256 checksum
How to use checksums
370deceab355e6aed5db6c81854761c9d8c3176897f26be6303f0f6cf5f7209e
BLAKE2b-256 checksum
How to use checksums
05ad0556d628c62e1c0e2c967a9695a5c1a33cfbf45f10562628b5a4e0f7e0fa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for ExifRead 2.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page