Skip to main content

Read Exif metadata from tiff and jpeg files.

Project description

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

Python library to extract EXIF data 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: if you use this library in your project as a Git submodule, you may need to do:

from <submodule_folder> import EXIF

or:

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)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ExifRead-2.0.0.tar.gz (31.2 kB view details)

Uploaded Source

Built Distribution

ExifRead-2.0.0-py2-none-any.whl (33.0 kB view details)

Uploaded Python 2

File details

Details for the file ExifRead-2.0.0.tar.gz.

File metadata

  • Download URL: ExifRead-2.0.0.tar.gz
  • Upload date:
  • Size: 31.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for ExifRead-2.0.0.tar.gz
Algorithm Hash digest
SHA256 661f07bc223bcf4ba6696955456ff039fb7e331574f344b5836f28bc8e93c2d2
MD5 fb26bcd14db141812b6cf68d33e02a67
BLAKE2b-256 d43cac5eee84963258e0911c8c54037f255e885f2b2527f26419e70d54986165

See more details on using hashes here.

File details

Details for the file ExifRead-2.0.0-py2-none-any.whl.

File metadata

File hashes

Hashes for ExifRead-2.0.0-py2-none-any.whl
Algorithm Hash digest
SHA256 443ae648b032ab685b0a795edabb42f4a043faa15643fbe0c350ba88bb029fa3
MD5 603bb4a27496de29ae38833429dcb72e
BLAKE2b-256 35fd7f1972b4a79898877f2dbcf9f41a816a8f189dc23c38ad9718791d29aa47

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 Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page