exiv2
Read, write, and manipulate image metadata
TLDR
Print a summary of the image Exif metadata
Print all metadata (Exif, IPTC, XMP) with interpreted values
Print all metadata with raw values
Delete all metadata from an image
Delete all metadata, preserving the file timestamp
Rename the file, prepending the date and time from metadata (not from the file timestamp)
SYNOPSIS
exiv2 [options] [action] [arguments] file ...
PARAMETERS
-v, --verbose
Display verbose messages, showing more details about operations.
-q, --quiet
Suppress all non-critical messages, showing only errors or warnings.
-V, --version
Output the program's version number and exit.
-h, --help
Display a concise help message with common options and actions.
-g <key>, --grep <key>
Filter output to show only lines containing the specified key or tag name.
-k, --keep
When modifying a file, keep the original file by adding an `_original` suffix.
-u, --usage
Print a brief usage statement for the command.
-a <value>, --adjust <value>
Adjust date/time Exif tags by the specified offset (e.g., '+1:0:0' for 1 hour). This is an action-specific option often used with 'mo' (modify).
-c <comment>, --comment <comment>
Set or update the JPEG comment of the image.
-T <type>, --type <type>
Specify the metadata type (e.g., 'Exif', 'IPTC', 'XMP') for actions.
--dryrun
Perform a dry run; simulate operations without making actual changes to files.
DESCRIPTION
exiv2 is a powerful command-line utility for manipulating metadata in digital images. It supports Exif, IPTC, and XMP metadata standards, as well as JPEG comments.
Users can read, write, modify, or delete metadata tags embedded in various image formats like JPEG, TIFF, PNG, and many RAW formats (e.g., Canon CR2, Nikon NEF). It's widely used by photographers, developers, and system administrators for tasks such as geotagging images, adding copyright information, adjusting date/time stamps, or simply inspecting detailed camera settings.
Its flexibility allows for complex batch operations and scripting, making it an essential tool for managing large collections of digital photos. exiv2 provides fine-grained control over metadata, ensuring data integrity and compliance with various metadata standards. It also supports printing metadata in human-readable or structured formats (e.g., CSV).
CAVEATS
Modifying metadata directly can be risky; always back up important files or use the -k (--keep) option. Different image formats have varying levels of metadata support (e.g., JPEG fully supports Exif/IPTC/XMP, while PNG mostly supports XMP). Incorrect manipulation can lead to corrupted tags or files. Ensure appropriate write permissions for files being modified. Some camera-specific or proprietary metadata might not be fully understood or editable by exiv2.
CORE ACTIONS
Beyond general options, exiv2 relies on specific 'actions' to perform its primary functions:
pr (print): Displays metadata from files in various formats.
ex (extract): Extracts metadata to sidecar files (e.g., .xmp, .icc profiles).
in (insert): Inserts metadata from sidecar files into images.
rm (remove): Removes all Exif, IPTC, and XMP metadata from a file.
ad (add): Adds a new tag with a specified value.
mo (modify): Modifies existing tags, often used with options like --adjust for date/time.
set: Directly sets a specific tag's value (e.g., exiv2 set Exif.Image.Artist "John Doe" file.jpg).
METADATA STANDARDS
exiv2 primarily deals with three major metadata standards:
Exif (Exchangeable image file format): Contains technical information about the photo, such as camera model, lens, exposure settings (shutter speed, aperture, ISO), date/time of capture, and GPS data.
IPTC (International Press Telecommunications Council): Mainly used for news photography, including descriptive information like captions, keywords, categories, photographer's contact details, and copyright information.
XMP (Extensible Metadata Platform): An Adobe-created, XML-based standard that is highly flexible. It can embed virtually any type of metadata, including ratings, labels, extended descriptions, and complex structured data. XMP is often used for metadata that spans across different applications and workflows.
HISTORY
exiv2 is implemented as a C++ library and a command-line tool, initially developed by Robin Mills with its first major release around 2004. It has since evolved into a widely recognized and utilized tool for programmatic access to image metadata. Its robust design and comprehensive feature set have led to its adoption in numerous open-source photography and image management projects, including darktable, digiKam, and gThumb. Active development continues to ensure compatibility with new camera models and evolving metadata standards.