LinuxCommandLibrary

exiftool

Read, write, and edit file metadata

TLDR

Print the EXIF metadata for a given file

$ exiftool [path/to/file]
copy

Remove all EXIF metadata from the given files
$ exiftool -All= [path/to/file1 path/to/file2 ...]
copy

Remove GPS EXIF metadata from given image files
$ exiftool "-gps*=" [path/to/image1 path/to/image2 ...]
copy

Remove all EXIF metadata from the given image files, then re-add metadata for color and orientation
$ exiftool -All= -tagsfromfile @ -colorspacetags -orientation [path/to/image1 path/to/image2 ...]
copy

Move the date at which all photos in a directory were taken 1 hour forward
$ exiftool "-AllDates+=0:0:0 1:0:0" [path/to/directory]
copy

Move the date at which all JPEG photos in the current directory were taken 1 day and 2 hours backward
$ exiftool "-AllDates-=0:0:1 2:0:0" [[-ext|-extension]] jpg
copy

Only change the DateTimeOriginal field subtracting 1.5 hours, without keeping backups
$ exiftool -DateTimeOriginal-=1.5 -overwrite_original
copy

Recursively rename all JPEG photos in a directory based on the DateTimeOriginal field
$ exiftool '-filename<DateTimeOriginal' [[-d|-dateFormat]] %Y-%m-%d_%H-%M-%S%%lc.%%e [path/to/directory] [[-r|-recurse]] [[-ext|-extension]] jpg
copy

SYNOPSIS

exiftool [OPTIONS] [-TAG[=VALUE]] [FILE | DIR ...]

exiftool -TAG[ [FILE | DIR ...]

exiftool -TAG[ [FILE | DIR ...]

exiftool -config FILE [FILE | DIR ...]

exiftool -csv [-r] [FILE | DIR ...]

exiftool -j [-r] [FILE | DIR ...]

PARAMETERS

-a, --all
    Include all tags, including duplicate and less common ones, in the output.

-b, --binary
    Output tag values in binary format. Useful for extracting embedded binary data.

-c CHARSET, --charset CHARSET
    Specify the character set for input or output text encoding (e.g., 'Latin' for ISO 8859-1).

-d FMT, --dateFormat FMT
    Specify the format for date/time tag values. Use strftime codes for custom formats.

-E, --escapeHTML
    Escape HTML special characters (e.g., '&', '<', '>') in the output.

-G[NUM], --groupNames[NUM]
    Print group name for each tag. NUM specifies the group level (e.g., -G0 for family 0, -G1 for family 1).

-h, --htmlFormat
    Output HTML-formatted pages, useful for generating reports in a web browser.

-j, --json
    Output metadata in JSON (JavaScript Object Notation) format.

-n, --noNumbers
    Print tag values numerically, without converting hex or numbers to text descriptions.

-o OUTFILE, --outFile OUTFILE
    Redirect the console output to a specified file.

-P, --preserve
    Preserve the original file modification date/time when writing tags.

-q, --quiet
    Quiet processing. Suppress warnings and minor error messages.

-r, --recurse
    Recursively process files in subdirectories.

-s[NUM], --short[NUM]
    Use a short output format. NUM specifies the level of abbreviation (e.g., -s1 for tag names only).

-t, --tabFormat
    Output results in a tab-separated list format, suitable for spreadsheets.

-u, --unknown
    Extract unknown tags, which are not part of known specifications.

-v[NUM], --verbose[NUM]
    Print verbose messages. Higher NUM values provide more detailed information.

-w FMT, --textOut FMT
    Write output text to a file, using a specified format string.

-X, --xmlFormat
    Output metadata in XML format.

-overwrite_original
    Overwrite the original file without creating a backup. Use with extreme caution!

-tagsFromFile SRC_FILE
    Copy tags from a specified source file to the current file(s).

-TAG=VALUE
    Write VALUE to the specified TAG. Use this syntax for modifying metadata.

-TAG
    Read the TAG value from the contents of a specified FILE.

-TAG
    Copy the value from SRC_TAG to TAG within the same file.

DESCRIPTION

exiftool is a powerful, flexible, and cross-platform Perl library and command-line application for reading, writing, and editing meta information in a wide variety of files. Developed by Phil Harvey, it supports many different metadata formats including Exif, IPTC, XMP, GPS, ID3, Photoshop IRB, FlashPix, ICC Profile, MIE, and many manufacturer-specific MakerNotes.

It can process numerous file types such as images (e.g., JPEG, TIFF, PNG, DNG, RAW formats), video (e.g., MOV, MP4, AVI, MPEG), audio (e.g., MP3, WAV), and various document formats (e.g., PDF, DOC, XLS). ExifTool is widely used by photographers, archivists, digital forensics specialists, and developers for tasks like extracting detailed technical information, geotagging photos, correcting timestamps, removing sensitive data, or synchronizing metadata across different files. Its ability to handle complex nested data structures and perform batch operations efficiently makes it an indispensable tool for managing digital assets. It automatically creates backup files (e.g., filename_original) when modifications are made, ensuring data safety.

CAVEATS

While powerful, exiftool operates directly on file metadata. By default, it creates backup copies (e.g., filename_original) before modification, but the use of the -overwrite_original option can permanently alter or destroy original data without a backup, so it must be used with extreme caution.

The extensive number of supported tags and options can present a steep learning curve for new users. As it's a Perl script, it requires a Perl interpreter, which is generally available on Linux distributions.

READING METADATA

To simply view all metadata in a file, run exiftool filename.ext.
To view specific tags, specify them: exiftool -creatordate -model image.jpg.
Adding options like -G will show the group for each tag, and -s will provide a short output format.

WRITING METADATA

To write or modify a tag, use the -TAG=VALUE syntax: exiftool -comment="My new comment" file.jpg.
Multiple tags can be written in a single command: exiftool -artist="John Doe" -copyright="© 2023 J. Doe" photo.jpg.
To remove a tag, assign an empty string: exiftool -keywords= image.png.

BATCH PROCESSING

ExifTool can process multiple files or entire directories recursively.
To process all JPEG files in the current directory: exiftool *.jpg.
To process all files in a directory and its subdirectories: exiftool -r ./path/to/directory/.
This allows for efficient bulk modification of metadata.

HISTORY

ExifTool was created and is actively maintained by Phil Harvey. Its initial public release was in 2003. Written entirely in Perl, it quickly gained popularity due to its comprehensive support for various metadata formats, cross-platform compatibility, and robust feature set. Over the years, it has become a de-facto standard for metadata manipulation, continuously updated to support new cameras, file formats, and metadata standards.

SEE ALSO

identify(1) (from ImageMagick) - A tool to describe the format and characteristics of one or more image files., file(1) - Determine file type., mediainfo(1) - Display technical and tag data for audio/video files., exiv2(1) - A C++ library and command-line utility to manage Exif, IPTC, and XMP metadata., jhead(1) - A command line program to manipulate EXIF data in JPEG files., ffprobe(1) (from FFmpeg) - Multimedia stream analyzer, useful for video/audio metadata.

Copied to clipboard