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] [file ...]
PARAMETERS
-p[a|s|i|t|X|R], --print[all|action-summary|iptc|structure|Xmp|Raw]
Print metadata: all, summary, IPTC, structure, XMP, or raw
-pi, --print-iptc
Print IPTC metadata in human-readable format
-pa, --print-all
Print all (Exif, IPTC, XMP) metadata
-P NAME VALUE, --set NAME VALUE
Set tag NAME to VALUE
-M CMD, --modify CMD
Modify command (set/add/del/reg/rm/mv/erase)
-u, --update
Update/insert metadata from corresponding files
-i, --info
Show file info (type, MIME, size, timestamp)
-e NAME, --extract NAME
Extract metadata/thumbnail to file NAME
-i NAME, --insert NAME
Insert metadata from file NAME
-r, --rename
Rename files based on first Exif datetime
-n, --num
Prepend sequence number to renamed files
-D[.] [fmt], --delete[-all][.] [fmt]
Delete Exif thumbnail/IPTC/XMP (all with .)
-k, --keep
Keep existing structure when inserting
--grep EXPR
Grep-like filter for tags matching EXPR
-f, --fixIptc
Fix invalid IPTC charsets
-v, --verbose
Verbose output
-q, --quiet
Suppress warnings/errors
-V, --version
Print version info
-h, --help
Show help
-O DIR, --output DIR
Output directory for extracted files
-b SIZE, --blocksize SIZE
Block size for large file processing
--save
Save changes immediately (default)
--nolog
Disable logging
--stdin
Read files from stdin
DESCRIPTION
Exiv2 is a robust command-line utility for reading, writing, deleting, and manipulating metadata in image files. It excels with EXIF, IPTC, and XMP standards across formats like JPEG, TIFF, PNG, WebP, HEIF, and more. Key features include printing structured metadata summaries, extracting embedded thumbnails or previews, inserting custom tags, batch renaming files based on EXIF data, and repairing corrupted metadata structures.
Developed as part of the Exiv2 C++ library, it's lightweight, fast, and script-friendly, making it ideal for automation in photo workflows. Common uses: inspecting camera settings from EXIF, embedding IPTC captions for print, stripping privacy data from XMP, or converting metadata formats. Exiv2 supports advanced operations like tag registration, raw data dumping, and charset handling for internationalization.
It's widely integrated into tools like darktable, digiKam, and gThumb, ensuring compatibility with professional photography pipelines. Output formats are human-readable or key-value pairs for easy parsing. Always test on copies, as modifications are in-place.
CAVEATS
Modifies files in-place; backup first. Some formats lack full write support. Large files may need --blocksize adjustment. Tag names case-sensitive.
COMMON EXAMPLES
Print all metadata: exiv2 -pa image.jpg
Set title: exiv2 -M"set Exif.Image.ImageDescription My Photo" image.jpg
Extract thumbnail: exiv2 -e thumbnail.jpg image.jpg
Rename by date: exiv2 -r *.jpg
MODIFY COMMANDS
Use -M with: set NAME VALUE, add NAME VALUE, del NAME, reg LANG NAME, rm LANG, mv SRC DST, erase FAMILY
HISTORY
Exiv2 began in 2003 by Andreas Huggel as a C++ library with CLI tool. Reached v0.25 in 2018 (CVE fixes), v0.27 (2021, WebP/HEIF), v0.28 (2023, AVIF). Key in open-source photo apps since early 2000s.


