Skip to content
Latchkey

exiftool: Read Image and File Metadata

exiftool image.jpg prints every metadata tag; exiftool -j image.jpg emits the same as JSON for scripts.

exiftool is the de facto tool for inspecting metadata in CI, whether asserting an image was stripped of GPS data or checking a generated file's tags. JSON output makes it scriptable.

What it does

exiftool parses metadata blocks (EXIF, IPTC, XMP, ICC, PDF info, and more) from a file and prints them as readable tag/value pairs. Selecting -TagName limits output to specific tags; -j produces JSON; -s and -G adjust naming and grouping.

Common usage

Terminal
# all metadata, human-readable
exiftool image.jpg
# specific tags only
exiftool -GPSLatitude -GPSLongitude -Make -Model image.jpg
# JSON for parsing in a script
exiftool -j image.jpg
# recurse a directory
exiftool -r -GPSPosition ./assets

Options

FlagWhat it does
-TagNamePrint only the named tag(s)
-j / -jsonOutput JSON
-sShort tag names (machine-friendly)
-GShow the group each tag belongs to
-rRecurse into directories
-qQuiet (suppress informational messages)

In CI

Use -j and parse with jq to assert metadata in tests, e.g. that uploaded images carry no GPS tags. -r plus a tag name audits a whole asset tree in one pass. Note exiftool exits 0 even when a tag is simply absent, so check the value, not just the exit code.

Common errors in CI

"exiftool: command not found" means it is not installed; apt-get install -y libimage-exiftool-perl (the Debian/Ubuntu package name is not "exiftool"). "File not found" is a wrong path. "Warning: Unknown file type" or "Error: File format error" means the input is not a media file or is corrupt. Because exiftool is a Perl script, a missing Perl interpreter triggers "/usr/bin/env: perl: No such file or directory".

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →