Skip to main content

Read Exif metadata from tiff and jpeg files.

Project description

Version:
1.3.1

Python library to extract EXIF data from tiff and jpeg files.

Originally written by Gene Cash / Thierry Bousch.

Installation

PyPI

This is the recomended process, it allows easily staying up to date.

$ pip install exifread

See https://pypi.python.org/pypi/pip for more info.

Archive

Download an archive from the releases page: https://github.com/ianare/exif-py/releases

Extract and enjoy.

Usage

Command line

$ EXIF.py image.jpg

Show command line options:

$ EXIF.py

Python Script

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

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

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'

Processing Options

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

Ignore MakerNote Tags

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

tags = EXIF.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 = EXIF.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 = EXIF.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-1.3.1.tar.gz (22.3 kB view details)

Uploaded Source

File details

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

File metadata

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

File hashes

Hashes for ExifRead-1.3.1.tar.gz
Algorithm Hash digest
SHA256 8655860e02325a877ff221d9d33cbf2e1c37ce6b6a2acd0d36262ce0949a7857
MD5 33053187dc6517efbffaab367aa63c0d
BLAKE2b-256 4bc7ed5be14afbede5caa5395df68d51466dd34688ae9107b6d7df9cf1bf61fb

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