ExifTool is a powerful command-line utility for reading and modifying metadata in files. Explore its basic usage and some useful applications.
Written by Jacob Gelman
Metadata is the additional information embedded in digital files, describing the content, quality, and other characteristics of the data. Some examples of meta tags include file creation and modification dates, technical specifications (like resolution and file format), descriptive tags (like titles and authors), and even GPS coordinates for photos.
Some meta tags are essential for a file to be read correctly whereas others are present for organizational or informational purposes; a photo's resolution must be accurately specified in its metadata in order for the pixel data within the file to be interpreted correctly whereas GPS coordinates, if present, are used solely for informational or organizational purposes.
The specifics of what meta tags are available and how they are encoded within a file varies based on file format. For instance, many image formats can include metadata about the camera used to capture it and its configuration (e.g. model, focal length, aperture, ISO, etc.). However, the way these tags are stored can vary between different image formats; a JPEG image uses EXIF (Exchangeable Image File Format) to store this metadata whereas a PNG image uses XMP (Extensible Metadata Platform).
ExifTool is a cross-platform command-line application for reading and editing metadata across various file formats. It acts as an abstraction layer over the specific metadata encoding used by any particular format, allowing the user to read and write metatags using a standard interface.
The following sections will explore how to use ExifTool to perform basic
operations as well as some practical use-cases. To try these examples out
yourself, first install ExifTool on your machine. Follow the official
installation guidefor your platform or, on
macOS, install using Homebrew: brew install exiftool
.
With a file selected, invoke ExifTool with the filepath and the names of the
meta tags to read. For instance, to read the width and height from
screenshot.png
in the current directory, you would run:
This command will print the value of each meta tag requested:
The ExifTool documentation includes an
extensive list of available tag
names and their possible values. Though ImageWidth
and ImageHeight
can be
used on images consistently regardless of their format, other tags are specific
to an individual format.
Run ExifTool providing a file path as the only argument: exiftool <filepath>
.
This command will read all the meta tags present in the file as well as
extra tags, metadata not present in
the file itself such as file permissions.
ExifTool also allows users to write new metadata to files or remove existing
tags. This can be useful for updating information or clearing out unnecessary
data. To write a specific tag, use the -TAG=VALUE
syntax. For example, to add
an author name to a file:
This command writes the Author
tag with the value “John Doe” to
document.pdf
. To remove a specific tag, you can set its value to an empty
string or use the -TAG=
syntax without a value. For instance, to remove the
Author
tag:
ExifTool can read metadata such as the date and GPS coordinates, allowing you to sort photos into folders based on events or places. For example, you can use the following command to copy photos into folders named after the city where they were taken:
This command recursively processes all photos in the specified directory,
reading the City
tag (if available) and moving each photo into a corresponding
folder.
Those publishing their creative works online may want to add copyright and usage
information directly in the file's metadata. This can be done using ExifTool to
write specific tags like Copyright
and UsageTerms
:
This command adds copyright information and usage terms to all JPEG files in the current directory, making it clear under what terms the photos can be used.
ExifTool is also helpful for removing sensitive or personal information from files before sharing them. For instance, if you've taken photos with a smartphone, they might contain GPS coordinates that reveal your location. To remove this data:
This command removes all GPS data and location tags from the JPEG files, helping to maintain privacy when sharing photos online.
Adding keywords to the metadata of your files can greatly improve their searchability and organization. For example, adding descriptive keywords to photos can make it easier to find specific images later:
This command adds the keywords "train," "rail," and "track" to station.jpg
,
making it easier to search for this image using any of these terms.
When dealing with multiple cameras or devices, timestamps can sometimes be incorrect or inconsistent due to varying time settings. ExifTool can correct these discrepancies by adjusting the timestamp metadata:
This command adjusts the DateTimeOriginal
tag for all photos in the specified
directory, adding one hour to each timestamp. This can be crucial for ensuring
that photos from multiple sources appear in the correct chronological order.
This article has only scratched the surface of what is possible with ExifTool. To go further with ExifTool, start by consulting the official resources and the ExifTool Tag Names for detailed guides on metadata tags and command options.