All Projects → ianare → Exif Py

ianare / Exif Py

Licence: bsd-3-clause
Easy to use Python module to extract Exif metadata from digital image files.

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Exif Py

Metadata Extractor
Extracts Exif, IPTC, XMP, ICC and other metadata from image, video and audio files
Stars: ✭ 1,972 (+251.52%)
Mutual labels:  webp, tiff, metadata, jpeg, exif
Sharp
High performance Node.js image processing, the fastest module to resize JPEG, PNG, WebP, AVIF and TIFF images. Uses the libvips library.
Stars: ✭ 21,131 (+3666.67%)
Mutual labels:  webp, tiff, jpeg, exif
Metadata Extractor Dotnet
Extracts Exif, IPTC, XMP, ICC and other metadata from image, video and audio files
Stars: ✭ 518 (-7.66%)
Mutual labels:  webp, metadata, jpeg, exif
Libvips
A fast image processing library with low memory needs.
Stars: ✭ 6,094 (+986.27%)
Mutual labels:  webp, tiff, jpeg
dartexif
Dart package to decode Exif data from tiff, jpeg and heic files
Stars: ✭ 16 (-97.15%)
Mutual labels:  jpeg, tiff, exif
Format parser
file metadata parsing, done cheap
Stars: ✭ 46 (-91.8%)
Mutual labels:  tiff, jpeg, exif
Exifr
📷 The fastest and most versatile JS EXIF reading library.
Stars: ✭ 448 (-20.14%)
Mutual labels:  tiff, metadata, exif
Pixterm
Draw images in your ANSI terminal with true color
Stars: ✭ 782 (+39.39%)
Mutual labels:  webp, tiff, jpeg
Piexif
Exif manipulation with pure python script.
Stars: ✭ 290 (-48.31%)
Mutual labels:  webp, jpeg, exif
tyf
Manipulate EXIF and IFD metadata.
Stars: ✭ 16 (-97.15%)
Mutual labels:  jpeg, tiff, exif
imagecodecs
Image transformation, compression, and decompression codecs. Forked from https://pypi.org/project/imagecodecs
Stars: ✭ 56 (-90.02%)
Mutual labels:  jpeg, tiff, webp
Govips
A lightning fast image processing and resizing library for Go
Stars: ✭ 442 (-21.21%)
Mutual labels:  webp, tiff, jpeg
Imageprocessor
📷 A fluent wrapper around System.Drawing for the processing of image files.
Stars: ✭ 2,452 (+337.08%)
Mutual labels:  webp, tiff, jpeg
sail
The missing small and fast image decoding library for humans (not for machines) ⛵ https://sail.software
Stars: ✭ 206 (-63.28%)
Mutual labels:  jpeg, tiff, webp
exif-rs
Exif parsing library written in pure Rust
Stars: ✭ 91 (-83.78%)
Mutual labels:  jpeg, tiff, exif
yoga-image-optimizer
A graphical tool to convert and optimize JPEG, PNG and WebP images (based on YOGA)
Stars: ✭ 85 (-84.85%)
Mutual labels:  jpeg, webp
Selene
A C++17 image representation, processing and I/O library.
Stars: ✭ 266 (-52.58%)
Mutual labels:  tiff, jpeg
go-xmp
A native Go SDK for the Extensible Metadata Platform (XMP)
Stars: ✭ 36 (-93.58%)
Mutual labels:  metadata, exif
Djv
Professional media review software for VFX, animation, and film production
Stars: ✭ 282 (-49.73%)
Mutual labels:  tiff, jpeg
Exifer
A lightweight Exif meta-data decipher.
Stars: ✭ 290 (-48.31%)
Mutual labels:  metadata, exif

EXIF.py


.. image:: https://travis-ci.org/ianare/exif-py.png :target: https://travis-ci.org/ianare/exif-py

Easy to use Python module to extract Exif metadata from digital image files.

Supported formats: TIFF, JPEG, Webp, HEIC

Compatibility


EXIF.py is tested and officially supported on the following Python versions:

  • 3.5
  • 3.6
  • 3.7
  • 3.8

Starting with version 3.0.0, Python2 compatibility is dropped completely (syntax errors due to type hinting).

https://pythonclock.org/

Installation


PyPI

The recommended process is to install the PyPI package <https://pypi.python.org/pypi/ExifRead>_, as it allows easily staying up to date::

$ pip install exifread

See the pip documentation <https://pip.pypa.io/en/latest/user_guide.html>_ for more info.

Archive

Download an archive from the project's releases page <https://github.com/ianare/exif-py/releases>_.

Extract and enjoy.

Usage


Command line

Some examples::

$ EXIF.py image1.jpg
$ EXIF.py -dc image1.jpg image2.tiff
$ find ~/Pictures -name "*.jpg" -o -name "*.tiff" | xargs EXIF.py

Show command line options::

$ EXIF.py -h

Python Script

.. code-block:: python

import exifread
# Open image file for reading (must be in 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:

.. code-block:: python

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:

.. code-block:: python

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

Stop at a Given Tag

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

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

.. code-block:: python

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:

.. code-block:: python

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

Usage Example

This example shows how to use the library to correct the orientation of an image (using Pillow for the transformation) before e.g. displaying it.

.. code-block:: python

import exifread
from Pillow import Image

def _read_img_and_correct_exif_orientation(path):
    im = Image.open(path)
    tags = {}
    with open(path, 'rb') as f:
        tags = exifread.process_file(f, details=False)
    if "Image Orientation" in tags.keys():
        orientation = tags["Image Orientation"]
        logging.debug("Orientation: %s (%s)", orientation, orientation.values)
        val = orientation.values
        if 5 in val:
            val += [4,8]
        if 7 in val:
            val += [4, 6]
        if 3 in val:
            logging.debug("Rotating by 180 degrees.")
            im = im.transpose(Image.ROTATE_180)
        if 4 in val:
            logging.debug("Mirroring horizontally.")
            im = im.transpose(Image.FLIP_TOP_BOTTOM)
        if 6 in val:
            logging.debug("Rotating by 270 degrees.")
            im = im.transpose(Image.ROTATE_270)
        if 8 in val:
            logging.debug("Rotating by 90 degrees.")
            im = im.transpose(Image.ROTATE_90)
    return im

Credit


A huge thanks to all the contributors over the years!

Originally written by Gene Cash & Thierry Bousch.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].