Extract EXIF Data from Photos using Python

How to extract the metadata from images using Pillow Library

Abhijith Chandradas
Geek Culture

--

What is EXIF data?

EXIF stands for ‘Exchangeable Image File Format’ and refers to the basic metadata that is generated and stored by your camera whenever you take a photo.
EXIF data in photography is generally used to refer the aperture, shutter speed, ISO, metering, white balance, camera model, lens specifications etc. of a photo.
Modern cameras, and mobile phones stores EXIF data and other important information viz- software used for processing, GPS information, make and model of the camera etc. For more information about EXIF data, refer this article.
All major social media platforms sanitize the photos uploaded by users of the metadata. Sanitizing the images is very important as the metadata could reveal critical information.
This article explains how to extract EXIF data from photos using python.

Import Libraries

The only library required to extract the EXIF data is pillow library. If pillow is not installed, it should be installed as given in Pillow Documentation.

from PIL import Image
from PIL.ExifTags import TAGS

Image module of pillow is used to read/open the photo.
TAGS
from ExifTags module of Pillow should also imported for understanding and decoding the exif data.

--

--

Abhijith Chandradas
Geek Culture

Data Analyst | Hacker | Financial Analyst | Freelancer | IIM MBA | Opensource | Democratize Knowledge | https://www.youtube.com/channel/UCLpBd4gzfIBXm2BPpdHOWdQ