You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

975 lines
39 KiB
Groff

.\" Hey, EMACS: -*- nroff -*-
.\" First parameter, NAME, should be all caps
.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
.\" other parameters are allowed: see man(7), man(1)
.TH EXIV2 1 "August 09, 2021"
.\" Please adjust this date whenever revising the manpage.
.\"
.\" Some roff macros, for reference:
.\" .nh disable hyphenation
.\" .hy enable hyphenation
.\" .ad l left justify
.\" .ad b justify to both left and right margins
.\" .nf disable filling
.\" .fi enable filling
.\" .br insert line break
.\" .sp <n> insert n+1 empty lines
.\" for manpage-specific macros, see man(7)
.SH NAME
exiv2 \- Image metadata manipulation tool
.SH SYNOPSIS
.B exiv2
[\fIoptions\fP] [\fIaction\fP] \fIfile\fP ...
.br
.SH DESCRIPTION
.PP
.\" TeX users may be more comfortable with the \fB<whatever>\fP and
.\" \fI<whatever>\fP escape sequences to invoke bold face and italics,
.\" respectively.
.B exiv2
is a program to read and write image metadata, including
Exif, IPTC, XMP, image comments, ICC Profile, thumbnails, image
previews and many vendor makernote tags. The program optionally
converts between Exif tags, IPTC datasets and XMP properties as
recommended by the Exif Standard, the IPTC Standard, the XMP
specification and the Metadata Working Group guidelines.
.br
The following image formats and metadata categories are supported:
.TS
lB lB lB lB lB lB lB
_ _ _ _ _ _ _
l l l l l l l.
Type Exif IPTC XMP Image Comments ICC Profile Thumbnail
ARW Read Read Read - - Read
AVIF Read Read Read - - Read
BMP - - - - - -
CR2 Read/Write Read/Write Read/Write - Read/Write Read/Write
CR3 Read Read Read - Read Read
CRW Read/Write - - Read/Write - Read/Write
DNG Read/Write Read/Write Read/Write - Read/Write Read/Write
EPS - - Read/Write - - -
EXV Read/Write Read/Write Read/Write Read/Write Read/Write Read/Write
GIF - - - - - -
HEIC Read Read Read - - Read
HEIF Read Read Read - - Read
JP2 Read/Write Read/Write Read/Write - Read/Write Read/Write
JPEG Read/Write Read/Write Read/Write Read/Write Read/Write Read/Write
MRW Read Read Read - - Read
NEF Read/Write Read/Write Read/Write - Read/Write Read/Write
ORF Read/Write Read/Write Read/Write - - Read/Write
PEF Read/Write Read/Write Read/Write - Read/Write Read/Write
PGF Read/Write Read/Write Read/Write Read/Write Read/Write -
PNG - Read/Write Read/Write - Read/Write Read/Write
PSD Read/Write Read/Write Read/Write - - Read/Write
RAF Read Read Read - - Read
RW2 Read Read Read - - Read
SR2 Read Read Read - - Read
SRW Read/Write Read/Write Read/Write - - Read/Write
TGA - - - - - -
TIFF Read/Write Read/Write Read/Write - Read/Write Read/Write
WEBP Read/Write - Read/Write - Read/Write Read/Write
XMP - - Read/Write - - -
.TE
.IP \(bu 2
Support for GIF, TGA and BMP images is minimal: the image format is
recognized, a MIME type assigned to it and the height and width of the
image are determined.
.IP \(bu 2
Reading other TIFF-like RAW image formats, which are not listed in the
table, may also work.
.IP \(bu 2
The thumbnail, if available, is included in the list of image previews.
.SH ACTIONS
The \fIaction\fP argument is only required if it is not clear from the
\fIoptions\fP which action is implied.
.TP
.B pr | print
Print image metadata. This is the default action, i.e. the command
\fBexiv2 image.jpg\fP will print a summary of the image Exif metadata.
.TP
.B ex | extract
Extract metadata to *.exv, XMP sidecar (*.xmp), preview image, thumbnail
or ICC profile file.
Modification commands can be applied on-the-fly.
.TP
.B in | insert
Insert metadata from corresponding *.exv, XMP sidecar (*.xmp),
thumbnail or ICC profile files. Use option \fB\--suffix\fP \fIsuf\fP to
change the suffix of the input files. Since files of any supported
format can be used as input files, this command can be used to copy
the metadata between files of different formats. Modification commands
can be applied on-the-fly.
.TP
.B rm | delete
Delete image metadata from the files.
.TP
.B ad | adjust
Adjust Exif timestamps by the given time. Requires at least one of the
options \fB\--adjust\fP \fItime\fP, \fB\--years\fP \fI+-n\fP, \fB\--months\fP
\fI+-n\fP or \fB\--days\fP \fI+-n\fP.
.TP
.B mo | modify
18 years ago
Apply commands to modify (add, set, delete) the Exif, IPTC and XMP
metadata of image files. Requires option \fB\--comment\fP \fItxt\fP,
\fB\--modify\fP \fIcmdfile\fP or \fB\--Modify\fP \fIcmd\fP.
.TP
.B mv | rename
Rename files and/or set file timestamps according to the Exif create
timestamp. Uses the value of tag Exif.Photo.DateTimeOriginal or, if
not present, Exif.Image.DateTime to determine the timestamp. The
filename format can be set with \fB\--rename\fP \fIfmt\fP, timestamp options
are \fB\--timestamp\fP and \fB\--Timestamp\fP.
.TP
.B fi | fixiso
Copy the ISO setting from one of the proprietary Nikon or Canon
makernote ISO tags to the regular Exif ISO tag,
Exif.Photo.ISOSpeedRatings. Does not overwrite an existing standard
Exif ISO tag.
.TP
.B fc | fixcom
Fix the character encoding of Exif Unicode user comments. Decodes the
comment using the auto-detected or specified character encoding and
writes it back in UCS-2. Use option \fB\--encode\fP \fIenc\fP to specify the current
encoding of the comment if necessary.
.br
.ne 40
.SH COMMAND SUMMARY
.sp 1
.nf
\fBexiv2\fP [ \fIoption\fP [\fIarg\fP] ]+ [ \fIaction\fP ] \fIfile\fP ...
.sp 1
Where \fIfile\fP contains image metadata, optionally using a URL prefix (e.g., https://clanmills.com/Stonehenge.jpg) or wildcard pattern (e.g., *.jpg)
.sp 1
\fBoption\fP [\fIarg\fP] \fBlong option\fP [\fIarg\fP] Description
\fB-a\fP \fItime\fP \fB--adjust\fP \fItime\fP Automatically modify metadata time stamps ...
\fB-b\fP \fB--binary\fP Obsolete and should not be used. Reserved for test suite (with \fB-p\fP\fIC\fP)
\fB-c\fP \fItxt\fP \fB--comment\fP \fItxt\fP JPEG comment string to set in the image. For the 'modify' action ...
\fB-d\fP \fItgt1\fP \fB--delete\fP \fItgt1\fP Delete target(s) for the 'delete' action ...
\fB-D\fP \fI+-n\fP \fB--days\fP \fI+-n\fP Automated adjustment of the days in metadata dates ...
\fB-e\fP \fItgt3\fP \fB--extract\fP \fItgt3\fP Extract target(s) for the 'extract' action ...
\fB-f\fP \fB--force\fP Do not prompt before overwriting existing files ...
\fB-F\fP \fB--Force\fP Do not prompt before renaming files ...
\fB-g\fP \fIstr\fP \fB--grep\fP \fIstr\fP Only output where \fIstr\fP matches in output text ...
\fB-h\fP \fB--help\fP Display help and exit
\fB-i\fP \fItgt2\fP \fB--insert\fP \fItgt2\fP Insert target(s) for the 'insert' action ...
\fB-k\fP \fB--keep\fP Preserve file timestamps when updating files ...
\fB-K\fP \fIkey\fP \fB--key\fP \fIkey\fP Report a key. Similar to \fB-g\fP, however \fIkey\fP must match exactly ...
\fB-l\fP \fIdir\fP \fB--location\fP \fIdir\fP Location (directory) for files to be inserted or extracted ...
\fB-m\fP \fIcmdfile\fP \fB--modify\fP \fIcmdfile\fP Read commands from a file ...
\fB-M\fP \fIcmd\fP \fB--Modify\fP \fIcmd\fP Modify the metadata with the command. For the 'modify' action ...
\fB-n\fP \fIenc\fP \fB--encode\fP \fIenc\fP Charset to decode Exif Unicode user comments ...
\fB-O\fP \fI+-n\fP \fB--months\fP \fI+-n\fP Automated adjustment of the months in metadata dates ...
\fB-p\fP \fImod\fP \fB--print\fP \fImod\fP Print report (common reports) ...
\fB-P\fP \fIflg\fP \fB--Print\fP \fIflg\fP Print report (fine grained control) ...
\fB-q\fP \fB--quiet\fP Silence warnings and error messages ...
\fB-Q\fP \fIlvl\fP \fB--log\fP \fIlvl\fP Set the log-level to 'd'(ebug), 'i'(nfo), 'w'(arning), 'e'(rror) ...
\fB-r\fP \fIfmt\fP \fB--rename\fP \fIfmt\fP Filename format for the 'rename' action ...
\fB-S\fP \fIsuf\fP \fB--suffix\fP \fIsuf\fP Use suffix for source files when using the 'insert' command ...
\fB-t\fP \fB--timestamp\fP Set the file timestamp from Exif metadata. For the 'rename' action ...
\fB-T\fP \fB--Timestamp\fP Only set the file timestamp from Exif metadata. For the 'rename' action ...
\fB-u\fP \fB--unknown\fP Show unknown tags ...
\fB-v\fP \fB--verbose\fP Verbose
\fB-V\fP \fB--version\fP Show the program version and exit ...
\fB-Y\fP \fI+-n\fP \fB--years\fP \fI+-n\fP Automated adjustment of the years in metadata dates ...
.sp 1
\fIaction\fP pr | ex | in | rm | ad | mo | mv | fi | fc
print, extract, insert, delete, adjust, modify, rename, fixiso, fixcom
\fIcmd\fP \fBset | add | del\fP \fIkey\fP [[\fItype\fP] \fIvalue\fP]
(see \fBCommand format\fP)
\fIenc\fP Values defined in \fBiconv_open\fP(3) (e.g., UTF-8)
\fIflg\fP E | I | X | x | g | k | l | n | y | c | s | v | t | h
Exif, IPTC, XMP, num, grp, key, label, name, type, count, size, vanilla, translated, hex
\fIfmt\fP Default format: %Y%m%d_%H%M%S
\fIkey\fP Exiv2 key using the format Family.Group.Tagname (e.g., Exif.Image.Model)
\fIlvl\fP d | i | w | e
debug, info, warning, error
\fImod\fP s | a | e | t | v | h | i | x | c | p | C | R | S | X
summary, all, Exif, translated, vanilla, hex, IPTC, XMP, comment, preview,
ICC Profile, Recursive Structure, Simple Structure, raw XMP
\fIsuf\fP '.' then the file's extension (e.g., '.txt')
\fItime\fP [+|-]HH[:MM[:SS[.mmm]]]
(Default is \fB+\fP when \fB+\fP/\fB-\fP are missing)
\fItgt1\fP a | c | e | i | t | x | C | -
all, comment, Exif, IPTC, thumbnail, XMP, ICC Profile, stdin/out
\fItgt\fP2 a | c | e | i | t | x | C | X | XX | -
all, comment, Exif, IPTC, thumbnail, XMP, ICC Profile, SideCar, Raw XMP, stdin/out
\fItgt3\fP a e | i | p | t | x | C | X | XX | -
all, Exif, IPTC, preview, thumbnail, XMP, ICC Profile, SideCar, Raw XMP, stdin/out
\fItype\fP An Exif, IPTC or XMP tag type (e.g., xmpText). See \fBEXIV2 TAGNAMES AND VALUES\fP
\fI+-n\fP The amount to change in the date (e.g., -3). Default is \fB+\fP when \fB+\fP/\fB-\fP are missing
.fi
.ne 40
.SH OPTIONS
.TP
.B \-h, --help
Display help and exit.
.TP
.B \-V, --version
Show the program version and exit.
When \fB\--version\fP is combined with \fB\--verbose\fP, build information
is printed to standard output along with a list of shared libraries which
have been loaded into memory. Verbose version is supported on Windows
(MSVC, Cygwin and MinGW builds), macOS and Linux and is provided for test
and debugging. The library name and version number are always printed, even
if output is filtered with \fB--grep\fP.
.TP
.B \-v, --verbose
Be verbose during the program run.
.TP
.B \-q, --quiet
Silence warnings and error messages during the program run. Note that
options \fB\--quiet\fP and \fB\--verbose\fP can be used at the same time.
.TP
.B \-Q \fIlvl\fP, --log \fIlvl\fP
Set the log-level to 'd'(ebug), 'i'(nfo), 'w'(arning), 'e'(rror)
or 'm'(ute), with the \fIlvl\fP chosen including those below it
('d' <- 'i' <- 'w' <- 'e'). The default log-level is 'w'. \fB\--log\fP \fIm\fP
is equivalent to \fB\--quiet\fP. All log messages are written to standard error.
.TP
.B \-u, --unknown
Show unknown tags. Default is to suppress tags which don't have a name (e.g., Exif.SonyMisc3c.0x022b).
.TP
.B \-g \fIstr\fP, --grep \fIstr\fP
When printing tags, display only those where \fIstr\fP is found in
the key (i.e., Family.Group.Tagname). When \fB--grep\fP \fIstr\fP is used
with \fB--verbose --version\fP, lines are included where \fIstr\fP matches in the
variable or value.
Multiple \fB\--grep\fP options can be used to output additional data:
.nf
\& $ exiv2 --verbose --version --grep webready --grep time
\& exiv2 1.0.0.9
\& time=11:01:53
\& enable_webready=1
\& xmlns=mediapro:http://ns.iview-multimedia.com/mediapro/1.0/
.fi
When the \fB--print\fP \fImod\fP and \fB--Print\fP \fIflgs\fP options are not specified, the default is \fB--print\fP \fIa\fP:
.nf
\& $ curl --silent -O https://clanmills.com/Stonehenge.jpg
\& $ exiv2 --grep Date Stonehenge.jpg
\& Exif.Image.DateTime Ascii 20 2015:07:16 20:25:28
\& Exif.Photo.DateTimeOriginal Ascii 20 2015:07:16 15:38:54
\& Exif.Photo.DateTimeDigitized Ascii 20 2015:07:16 15:38:54
\& Exif.NikonWt.DateDisplayFormat Byte 1 Y/M/D
\& Exif.GPSInfo.GPSDateStamp Ascii 11 2015:07:16
\& Xmp.xmp.ModifyDate XmpText 25 2015-07-16T20:25:28+01:00
.fi
.sp 1
You may use \fB--print\fP \fImod\fP or \fB--Print\fP \fIflgs\fP to further filter output (\fB--print\fP \fIs\fP is ignored):
.nf
\& $ exiv2 --print x --grep Date Stonehenge.jpg
\& Xmp.xmp.ModifyDate XmpText 25 2015-07-16T20:25:28+01:00
.fi
.sp 1
.br
\fIstr\fP can contain an optional \fI/i\fP modifier at the end, to indicate case insensitivity:
.nf
\& $ exiv2 --print px --grep date/i Stonehenge.jpg
\& Xmp.xmp.ModifyDate XmpText 25 2015-07-16T20:25:28+01:00
.TP
.B \-K \fIkey\fP, --key \fIkey\fP
Only reports tags for a given \fIkey\fP, which must match the Family.Group.Tagname exactly.
.sp 1
Multiple \fB\--key\fP options can be used to report more than a single key:
.nf
\& $ curl --silent -O https://clanmills.com/Stonehenge.jpg
\& $ exiv2 \--key Exif.Photo.DateTimeDigitized --key Exif.Photo.DateTimeOriginal Stonehenge.jpg
\& Exif.Photo.DateTimeOriginal Ascii 20 2015:07:16 15:38:54
\& Exif.Photo.DateTimeDigitized Ascii 20 2015:07:16 15:38:54
.fi
.TP
.B \-n \fIenc\fP, --encode \fIenc\fP
Charset to use when decoding Exif Unicode user comments, where \fIenc\fP is
a name understood by \fBiconv_open\fP(3) (e.g., 'UTF-8').
.TP
.B \-k, --keep
Preserve file timestamps when updating files. Can be used with
all options which update files and is ignored by read-only
options.
.TP
.B \-t, --timestamp
Set the file timestamp according to the Exif create timestamp in
addition to renaming the file (overrides \fB\--keep\fP). This option is
only used with the 'rename' action.
.TP
.B \-T, --Timestamp
Only set the file timestamp according to the Exif create timestamp, do
not rename the file (overrides \fB\--keep\fP). This option is only used
19 years ago
with the 'rename' action. Note: On Windows you may have to set the TZ
environment variable for this option to work correctly.
.TP
.B \-f, --force or \-F, --Force
These options are used by the 'rename' and 'extract' actions to
determine the file overwrite policy. The options override the default
behavior, which is to prompt the user if the filename already exists.
These options are usually combined with \fB--verbose\fP, to provide
dditional status output.
.sp 1
The 'rename' action will overwrite files when \fB--force\fP is used.
Instead, if \fB--Force\fP is used and the file already exists, the new filename
is appended with '_1' ('_2', ...) to prevent data loss.
.sp 1
The 'extract' action will overwrite files when either \fB--force\fP or
\fB--Force\fP is used.
.sp 1
For example, renaming a file using \fB--Force\fP, where the same filename
has already been renamed:
.nf
\& $ curl --silent -O https://clanmills.com/Stonehenge.jpg
\& $ exiv2 --verbose --Force rename Stonehenge.jpg
\& File 1/1: Stonehenge.jpg
\& Renaming file to ./20150716_153854.jpg
\& $ curl --silent -O https://clanmills.com/Stonehenge.jpg
\& $ exiv2 --verbose --Force rename Stonehenge.jpg
\& File 1/1: Stonehenge.jpg
\& Renaming file to ./20150716_153854_1.jpg
.fi
.br
.TP
.B \-r \fIfmt\fP, --rename \fIfmt\fP
Filename format for the 'rename' action. The \fIfmt\fP string follows
the definitions in \fBstrftime\fP(3), using Exif.Photo.DateTimeOriginal
or Exif.Image.DateTime as the reference date and time.
In addition, the following special character sequences are also provided:
.TS
l l l.
:basename: Original filename without extension
:dirname: Name of the directory holding the original file
:parentname: Name of parent directory
.TE
.sp 1
The default \fIfmt\fP is %Y%m%d_%H%M%S
.sp 1
For example, renaming a file when \fIfmt\fP is made up of the basename, day, short month and long year:
.nf
\& $ curl --silent -O https://clanmills.com/Stonehenge.jpg
\& $ exiv2 --verbose --rename ':basename:_%d_%b_%Y' Stonehenge.jpg
\& File 1/1: Stonehenge.jpg
\& Renaming file to ./Stonehenge_16_Jul_2015.jpg
.fi
.sp 1
If the filename to rename to already exists and \fB--Force\fP and \fB--force\fP
are not used, the user is prompted for an action.
.TS
l l.
[O]verwrite Rename the file, overriding the existing one
[r]ename Rename the file, but append '_1' ('_2', ...) to the new filename
[s]kip Cancel renaming this file
.TE
.sp 1
For example, when renaming a second Stonehenge.jpg file:
.nf
\& $ curl --silent -O https://clanmills.com/Stonehenge.jpg
\& $ exiv2 --verbose --rename ':basename:_%d_%b_%Y' Stonehenge.jpg
\& File 1/1: Stonehenge.jpg
\& exiv2.exe: File `./Stonehenge_16_Jul_2015.jpg' exists. [O]verwrite, [r]ename or [s]kip? r
\& Renaming file to ./Stonehenge_16_Jul_2015_1.jpg
.fi
.sp 1
.TP
.B \-a \fItime\fP, \--adjust \fItime\fP
Time adjustment, where \fItime\fP is in the format [\-]HH[:MM[:SS]]. This option is only
used with the 'adjust' action.
.sp 1
Examples of \fItime\fP are:
.TS
l l.
+1 Adds one hour
1:01 Adds one hour and one minute
-0:00:30 Subtracts 30 seconds.
.TE
.sp 1
.TP
.B \-Y \fI+-n\fP, --years \fI+-n\fP
Time adjustment by a positive or negative number of years, for
the 'adjust' action.
.TP
.B \-O \fI+-n\fP, --months \fI+-n\fP
Time adjustment by a positive or negative number of months, for
the 'adjust' action.
.TP
.B \-D \fI+-n\fP, \--days \fI+-n\fP
Time adjustment by a positive or negative number of days, for
the 'adjust' action.
.TP
.B \-p \fImode\fP, --print \fImode\fP,
Print mode for the 'print' action (see \fBDESCRIPTION\fP, for metadata support in a file type). Possible modes are:
7 years ago
.TS
l l.
s A summary of the Exif metadata (the default for the 'print' action)
a Exif, IPTC and XMP metadata (shortcut for \fB\--Print\fP \fIkyct\fP)
e Exif metadata (shortcut for \fB\--Print\fP \fIEkycv\fP)
t Interpreted (translated) Exif tag values (shortcut for \fB\--Print\fP \fIEkyct\fP)
v Plain (untranslated) Exif tag values (shortcut for \fB\--Print\fP \fIExgnycv\fP)
h Hexdump of the Exif data (shortcut for \fB\--Print\fP \fIExgnycsh\fP)
i IPTC datasets (shortcut for \fB\--Print\fP \fIIkyct\fP)
x XMP properties (shortcut for \fB\--Print\fP \fIXkyct\fP)
c JPEG comment
p List available image previews, sorted by size in pixels (for example, see \fB--extract\fP \fItgt3\fP)
C Image ICC Profile
R Print image structure recursively (only for the 'debug' build with jpg, png, tiff, webp, cr2 and jp2 types)
S Image structure information (jpg, png, tiff, webp, cr2 and jp2 types only)
X "raw" XMP
7 years ago
.TE
.sp 1
\fB--print\fP \fImode\fP can be combined with \fB--grep\fP \fIstr\fP or \fB--key\fP \fIkey\fP to further filter the output.
.sp 1
For the order of the columns in the output, see \fB--Print\fP \fIflgs\fP.
.TP
.B \-P \fIflgs\fP, \-Print \fIflgs\fP
Print flags allows fine control of the tag list for the 'print' action
(see \fBDESCRIPTION\fP, for metadata support in a file type). The option
allows control of the type of metadata as well as data columns included in
the print output. Valid flags are:
7 years ago
.TS
l l.
E Exif tags
I IPTC datasets
X XMP properties
x Tag number for Exif or IPTC tags (in hexadecimal)
g Group name (e.g., for Exif.Photo.UserComment, outputs Photo)
k Key (e.g., Exif.Photo.UserComment)
l Tag label (human readable tagname, e.g., for Exif.Photo.UserComment, outputs 'User comment')
n Tagname (e.g., for Exif.Photo.UserComment, outputs UserComment)
y Type (for available types, see \fBExif/IPTC/XMP types\fP)
c Number of components (for single entry types, the number of \fBsizeof('type')\fP in 'size'. For multi-entry types, the number of entries. See \fBExif/IPTC/XMP types\fP)
s Size in bytes
v Plain data value (vanilla values, i.e., untranslated)
V Plain data value AND the word 'set ' (for use with \fB--modify\fP \fI-\fP option)
t Interpreted (translated) human readable data values
h Hexdump of the data
7 years ago
.TE
The order of the values in \fIflgs\fP is not respected, with output
displayed as follows:
.sp 1
Tag number (x) | Plain 'set' (V) | Group (g) | Key (k)| Tagname (n)| Tagname label (l) | Type (y) | Components (c) | Size (s) | Value (E, I, X, v, t)
.sp 1
For example, displaying the IPTC tags in a file:
.nf
\& $ curl --silent -O https://clanmills.com/Stonehenge.jpg
\& $ exiv2 --Print xgknlycsIt Stonehenge.jpg
\& 0x0000 Envelope Iptc.Envelope.ModelVersion ModelVersion Model Version Short 1 2 4
\& 0x005a Envelope Iptc.Envelope.CharacterSet CharacterSet Character Set String 3 3
\& 0x0000 Application2 Iptc.Application2.RecordVersion RecordVersion Record Version Short 1 2 4
\& 0x0078 Application2 Iptc.Application2.Caption Caption Caption String 12 12 Classic View
.fi
.sp 1
\fB--Print\fP \fIflgs\fP can be combined with \fB--grep\fP \fIstr\fP or \fB--key\fP \fIkey\fP to further filter the output.
.TP
.B \-d \fItgt1\fP, \--delete \fItgt1\fP
Delete target(s) for the 'delete' action. Possible targets are:
7 years ago
.TS
l l.
a All supported metadata (the default for the 'delete' action)
e Exif section
t Exif thumbnail only
i IPTC data
x XMP packet
c JPEG comment
C ICC Profile
I All IPTC data (removes broken metadata containing multiple IPTC blocks)
7 years ago
.TE
.TP
.B \-i \fItgt2\fP, --insert \fItgt2\fP
Insert target(s) for the 'insert' action (see \fBDESCRIPTION\fP, for metadata support in a file type). Possible targets are:
.sp 1
.TS
l l.
a All supported metadata (the default for the 'insert' action)
e Exif section
t Exif thumbnail. Only JPEG thumbnails can be inserted from a file called \fIfile-thumb.jpg\fP
i IPTC data
x XMP packet
c JPEG comment
C ICC Profile, inserted from a file called \fI<file>.icc\fP
X Insert metadata from an XMP sidecar file, <file>.xmp. The remaining targets determine which metadata to include, possible are Exif, IPTC and XMP (default is all of these). Inserted XMP properties include those converted to Exif and IPTC
XX Insert "raw" XMP metadata from a sidecar file, <file>.exv
- Insert from stdin. This option is intended for "filter" operations
.TE
.sp 1
Filter operations between extract and insert are possibile, using the following template; \fBxmllint\fP can be optionally used when extracting XMP sidecar files:
.sp 1
.nf
\& $ exiv2 -e{tgt3}- filename | [ xmllint .... |] exiv2 -i{tgt2}- filename
.fi
.sp 1
.TP
.B \-e \fItgt3\fP, --extract \fItgt3\fP
Extract target(s) for the 'extract' action. Possible targets are:
.br
.TS
l l.
a All supported metadata (the default for the 'extract' action)
e Exif section
t Extract Exif thumbnail only to a file called \fI<file>-thumb.jpg\fP
i IPTC data
x XMP packet
c JPEG comment
p[<n>[,<m> ...]] Extract preview images to files called \fI<file>-preview<n | m | ...>.jpg\fP (\fB--extract\fP \fIp\fP extracts all previews). The thumbnail is included in any preview images
C Extract ICC profile, to a file called \fI<file>.icc\fP
X Extract metadata to an XMP sidecar file, <file>.xmp, the remaining targets determine what metadata to extract (default is Exif, IPTC and XMP). Supported Exif and IPTC data is stored as XMP tags
XX Extract "raw" XMP metadata to a sidecar . Other targets cannot be used with this, as only XMP data is written
- Output to stdout (see \fB\--insert\fP \fItgt2\fP for an example of this feature)
.TE
.sp 1
When extracting preview images, first list which previews are available:
.nf
\& $ curl --silent -O https://clanmills.com/Stonehenge.jpg
\& $ exiv2 --print p Stonehenge.jpg
\& Preview 1: image/jpeg, 160x120 pixels, 10837 bytes
.fi
then extract the preview by number (in this case, preview 1 is also the thumbnail):
.nf
\& $ exiv2 --verbose --extract p1 Stonehenge.jpg
\& File 1/1: Stonehenge.jpg
\& Writing preview 1 (image/jpeg, 160x120 pixels, 10837 bytes) to file ./Stonehenge-preview1.jpg
.fi
.sp 1
.TP
.B \-c \fItxt\fP, --comment \fItxt\fP
JPEG comment string to set in the image ('modify' action). This option
can also be used with the 'extract' and 'insert' actions to modify
metadata on-the-fly.
.TP
.B \-m \fIcmdfile\fP, --modify \fIcmdfile\fP
Command file for the 'modify' action (see \fBCommand file format\fP).
This option can also be used with the 'extract' and 'insert' actions
to modify metadata on-the-fly. \fB--modify-\fP reads modify commands
from standard-input.
.TP
.B \-M \fIcmd\fP, --Modify \fIcmd\fP
Command line for the 'modify' action (see \fBCOMMANDS\fP). This option
can also be used with the 'extract' and 'insert' actions to modify
metadata on-the-fly. The format for the commands is the same as that
of the lines of a command file.
.TP
.B \-l \fIdir\fP, --location \fIdir\fP
Location (directory) for files to be inserted from or extracted to.
.TP
.B \-S \fIsuf\fP, --suffix \fIsuf\fP
Use suffix \fIsuf\fP for source files when using 'insert' action (e.g., '.txt').
.br
.ne 40
.SH COMMANDS
Commands for the 'modify' action can be read from a command file, e.g.,
.sp 1
.nf
$ exiv2 \-m cmd.txt image.jpg
.fi
.sp 1
or given on the command line, as in
.sp 1
.nf
$ exiv2 \-M"add Iptc.Application2.Credit String Mr. Smith" image.jpg
.fi
.sp 1
Note the quotes. Multiple \fB\-m\fP and \fB\-M\fP options can be combined,
and a non-standard XMP namespace registered.
.sp 1
.nf
$ exiv2 \-M"reg myprefix http://ns.myprefix.me/" \-M"add Xmp.myprefix.Whom Mr. Smith" \-M"set Exif.Image.Artist Mr. Smith" image.jpg
.fi
.sp 1
When writing Exif, IPTC and XMP metadata,
.B exiv2
enforces only a correct
metadata structure. It is possible to write tags with types and values
different from those specified in the standards, duplicate Exif tags,
undefined tags, or incomplete metadata. While
.B exiv2
is able to read
all metadata that it can write, other programs may have difficulties
with images that contain non standard-conforming metadata.
.SS Command format
The format of a command is
.sp 1
.nf
\fBset | add | del\fP \fIkey\fP [[\fItype\fP] \fIvalue\fP]
.fi
.TP
.B set
Set the \fIvalue\fP of an existing tag with a matching \fIkey\fP or
add the tag.
.TP
.B add
Add a tag (unless \fIkey\fP is a non\-repeatable IPTC key; nothing
prevents you from adding duplicate Exif tags).
.TP
.B del
Delete all occurrences of a tag (requires only a \fIkey\fP).
.TP
.B key
Exiv2 Exif, IPTC or XMP key.
.TP
.B type
Exif keys: Byte | Ascii | Short | Long | Rational | Undefined | SShort | SLong | SRational | Comment
.br
IPTC keys: String | Date | Time | Short | Undefined
18 years ago
.br
XMP keys: XmpAlt | XmpBag | XmpSeq | LangAlt
.sp 1
A default \fItype\fP is used if none is explicitly given. The default
is determined based on \fIkey\fP.
.TP
.B value
The remaining text on the line is the value. It can optionally be
enclosed in single quotes ('\fIvalue\fP') or double quotes ("\fIvalue\fP").
.sp 1
The value is optional. Not providing any value is equivalent to an
empty value ("") and is mainly useful to create an XMP array property,
e.g., a bag.
.sp 1
The format of Exif \fBComment\fP values include an optional charset
specification at the beginning. Comments are used by the tags Exif.Photo.UserComment, Exif.GPSInfo.GPSProcessingMethod
and Exif.GPSInfo.GPSAreaInformation. Comments are stored as Undefined tags with an 8 byte encoding
definition follow by the encoded data. The charset is specified as follows:
.sp 1
[charset=Ascii|Jis|Unicode|Undefined] \fIcomment\fP
.br
charset=Undefined is the default
.sp 1
.nf
$ exiv2 -M'set Exif.Photo.UserComment charset=Ascii My photo' x.jpg
$ exiv2 -pa --grep UserComment x.jpg
Exif.Photo.UserComment Undefined 16 My photo
$ exiv2 -pv --grep UserComment x.jpg
0x9286 Photo UserComment Undefined 16 charset=Ascii My photo
$ exiv2 -M'set Exif.Photo.UserComment charset=Unicode \\u0052\\u006f\\u0062\\u0069\\u006e' x.jpg
$ exiv2 -pa --grep UserComment x.jpg
Exif.Photo.UserComment Undefined 18 Robin
$ exiv2 -pv --grep UserComment x.jpg
0x9286 Photo UserComment Undefined 18 charset=Unicode Robin
$ exiv2 -M'set Exif.GPSInfo.GPSProcessingMethod HYBRID-FIX' x.jpg
$ exiv2 -pa --grep ProcessingMethod x.jpg
Exif.GPSInfo.GPSProcessingMethod Undefined 18 HYBRID-FIX
$ exiv2 -pv --grep ProcessingMethod x.jpg
0x001b GPSInfo GPSProcessingMethod Undefined 18 HYBRID-FIX
.fi
.sp 1
The format for an IPTC \fBDate\fP value is: YYYY\-MM\-DD (year, month, day)
.sp 1
The format for an IPTC \fBTime\fP value is: HH:MM:SS (hours, minutes, seconds) and may optionally be followed by: -HH:MM or +HH:MM (hours, minutes ahead/behind UTC)
.sp 1
The format of \fBRational\fP (and \fBSRational\fP) is one of: \fBinteger | integer/integer | Fnumber | number\fP
.br
\fBRational\fP Examples:
.sp 1
.nf
$ exiv2 "-Mset Exif.Photo.MaxApertureValue 557429/62500" X.jpg
$ exiv2 "-Mset Exif.Photo.MaxApertureValue F5.6" X.jpg
.fi
.sp 1
The \fBRational\fP format Fnumber is for the convenience of setting aperture values. Aperture values
are stored in Exif is an \fBAPEX\fP value which can be evaluated by the expression:
.sp 1
.nf
apex-value = log(Fnumber) * 2.0 / log(2.0)
number = exp(apex-value * log(2.0) / 2.0)
.fi
.sp 1
The \fBRational\fP format Fnumber is valid for any \fBRational\fP, even when the key is not an Aperture.
More information about \fBAPEX\fP value is available from: http://en.wikipedia.org/wiki/APEX_system
.sp 1
The format of XMP \fBLangAlt\fP values includes an optional language qualifier:
.nf
.B lang="\fIlanguage-code\fP\fI" text\fP
.fi
.sp
The double quotes around the \fIlanguage-code\fP are optional. If no languge qualifier
is supplied, then the value of "x-default" is used. More information
on the language format can be found at: https://www.ietf.org/rfc/rfc3066.txt
.sp 1
.nf
$ exiv2 -M'set Xmp.dc.title lang="de-DE" Euros' X.jpg
$ exiv2 -M'set Xmp.dc.title lang="en-GB" Pounds' X.jpg
$ exiv2 -M'set Xmp.dc.title lang="en-US" In God We Trust' X.jpg
$ exiv2 -M'set Xmp.dc.title lang=fr-FR Euros' X.jpg
$ exiv2 -M'set Xmp.dc.title lang=jp Yen' X.jpg
$ exiv2 -M'set Xmp.dc.title All others pay cash' X.jpg
.fi
.sp 1
To remove a language specification, set the value to '' (empty string)
.nf
$ exiv2 -M'set Xmp.dc.title lang="en-US"' X.jpg
.fi
To remove all language specifications, delete the key:
.nf
$ exiv2 -M'del Xmp.dc.title' X.jpg
.fi
To register additional XMP namespaces, combine the command with:
18 years ago
.nf
\fBreg\fP \fIprefix\fP \fInamespace\fP
.fi
.SS Command file format
Empty lines and lines starting with \fB#\fP in a command file are
ignored (comments). Remaining lines are commands as described above.
.br
.ne 40
.SH EXIV2 TAGNAMES AND VALUES
Exiv2 displays metadata tags and values.
.sp 1
The tag is a triplet of Family.Group.Tagname. The following groups are defined for the family Exif:
.sp 1
.nf
GPSInfo Canon Fujifilm NikonMe OlympusFe7 SonyMisc2b
Image CanonCf NikonPc OlympusFe9 SonyMisc3c
Image2 CanonCs Nikon1 NikonPreview OlympusFi SonyMinolta
Image3 CanonFi Nikon2 NikonSi01xx OlympusIp SonySInfo1
Iop CanonPa Nikon3 NikonSi02xx OlympusRd
MakerNote CanonPi NikonAFT NikonSiD300a OlympusRd2 Samsung2
MpfInfo CanonPr NikonAf NikonSiD300b OlympusRi SamsungPictureWizard
Photo CanonSi NikonAf2 NikonSiD40 SamsungPreview
SubImage1 CanonTi NikonAf22 NikonSiD80 Sigma
SubImage2 NikonCb1 NikonVr
SubImage3 Casio NikonCb2 NikonWt Sony1
SubImage4 Casio2 NikonCb2a Sony1Cs
SubImage5 NikonCb3 Olympus Sony1Cs2
SubImage6 Minolta NikonCb4 Olympus2 Sony1MltCs7D
SubImage7 MinoltaCs5D NikonFi OlympusCs Sony1MltCsA100
SubImage8 MinoltaCs7D NikonFl1 OlympusEq Sony1MltCsNew
SubImage9 MinoltaCsNew NikonFl2 OlympusFe1 Sony1MltCsOld
SubThumb1 MinoltaCsOld NikonFl3 OlympusFe2 Sony2
Thumbnail NikonIi OlympusFe3 Sony2Cs
Panasonic NikonLd1 OlympusFe4 Sony2Cs2
Pentax PanasonicRaw NikonLd2 OlympusFe5 Sony2Fp
PentaxDng NikonLd3 OlympusFe6 SonyMisc1
.fi
.sp 1
Exiv2 supports Exif 2.2 Standard Tags. Exiv2 also supports reading and writing manufacturer's MakerNote. The information in Exif.Photo.MakerNote is encoded as manufacturer's sub-records. For example, CanonCs are Camera Settings, NikonAf are Nikon Auto Focus records, NikonCb are Nikon Color Balance Records. Every tag is defined by a unique tagId (16 bit integer) which is unique within a Group.
.sp
You can query Exiv2 groups and tags with the sample program taglist which is documented in \fIhttps://github.com/Exiv2/exiv2/blob/main/README-SAMPLES.md\fP
.sp
.ne 20
Exif Metadata values are defined in the Exif Standard. All data is an array of data elements. The Count defines the number elements in the array. All elements in an array have the same type.
.sp 1
.SS Exif/IPTC/XMP types
.nf
Type Explanation
1 BYTE An 8-bit unsigned integer.
2 ASCII 7-bit ASCII. NUL terminated.
3 SHORT A 16-bit (2-byte) unsigned integer.
4 LONG A 32-bit (4-byte) unsigned integer
5 RATIONAL Two LONGs. Numerator, denominator.
7 UNDEFINED An 8-bit byte.
8 SSHORT A 16-bit (2-byte) signed integer.
9 SLONG A 32-bit (4-byte) signed integer.
10 SRATIONAL Two SLONGs. Numerator, denominator.
.fi
.sp
The printing flag t = translated and is intended for human use. Scripts should never use translated values as they are localised and the format may change as Exiv2 evolves. The printing flag v reports the values recorded in the metadata and should be used by scripts.
.ne 8
.fi
.SS Exif DateTime
.fi
An Exif DateTime string is stored as 20 ascii bytes (including trailing NULL) in the format:
.sp 1
YYYY:MM:DD HH:MM:SS
.sp 1
The \fBexiv2\fP options \fB--timestamp\fP and \fB--Timestamp\fP will accept files
in which the Date has been incorrectly stored as YYYY-MM-DD.
The option \fB--adjust\fP \fItime\fP enables the user to adjust the DateTime in the file and applies
the YYYY:MM:DD HH:MM:SS standard.
.sp 1
.ne 40
.SH CONFIGURATION FILE
\fBexiv2\fP can read an optional configuration file, which allows
additional lens definitions to be added to translated output. On UNIX based
systems, this file is called \fI.exiv2\fP and on Windows, \fIexiv2.ini\fP.
The file is searched for first in the current directory, then in the
home directory (on UNIX based systems, \fI~/\fP and on Windows, \fI%USERPROFILE%\\\fP).
.sp 1
You can determine the name of the file and where it is searched for,
with the command:
.sp 1
.nf
\& $ exiv2 --verbose --version --grep config_path
\& exiv2 1.0.0.9
\& config_path=/Users/rmills/.exiv2
.fi
.sp 1
The configuration file uses the Windows \fI.ini\fP format (see \fIhttps://en.wikipedia.org/wiki/INI_file\fP)
and has sections for each of the major camera manufactures: Canon, Minolta,
Nikon, Olympus, Pentax and Sony. The configuration file definitions override any existing
values.
.br
.sp 1
For example, to add a new lens definition, first obtain the lensID for
your camera:
.sp 1
.nf
\& $ curl --silent -O https://clanmills.com/Stonehenge.jpg
\& $ exiv2 --print v --grep lens/i Stonehenge.jpg
\& 0x0083 Nikon3 LensType Byte 1 14
\& 0x0084 Nikon3 Lens Rational 4 180/10 2500/10 35/10 63/10
\& 0x008b Nikon3 LensFStops Undefined 4 55 1 12 0
\& 0x000c NikonLd3 LensIDNumber Byte 1 146
\& 0x000d NikonLd3 LensFStops Byte 1 55
.fi
.sp 1
Then using the 'LensIDNumber' value (i.e., 146), add the following text to
the configuration file:
.sp 1
.nf
\& [nikon]
\& 146=Robin's Sigma Lens
.fi
.sp 1
The text will now appear when the translated print option is used:
.sp 1
.nf
\& $ exiv2 --print t --grep lens/i Stonehenge.jpg
\& Exif.Nikon3.LensType Byte 1 D G VR
\& Exif.Nikon3.Lens Rational 4 18-250mm F3.5-6.3
\& Exif.Nikon3.LensFStops Undefined 4 4.58333
\& Exif.NikonLd3.LensIDNumber Byte 1 Robin's Sigma Lens
\& Exif.NikonLd3.LensFStops Byte 1 F4.6
.fi
.sp 1
.ne 40
.SH EXAMPLES
.nf
\fB$ exiv2 *.jpg\fP
.fi
Prints a summary of the Exif information for all JPEG files in the directory. The summary is brief and does not use the Family.Group.Tag format.
.sp 1
.nf
\fB$ exiv2 -g Date https://clanmills.com/Stonehenge.jpg\fP
.fi
If you use \fB--grep\fP \fIkey\fP, the default output becomes \fB--print\fP \fIa\fP
.sp 1
.nf
\fB$ exiv2 \-pi image.jpg\fP
.fi
Prints the IPTC metadata of the image.
.sp 1
.nf
\fB$ exiv2 rename img_1234.jpg\fP
.fi
Renames img_1234.jpg (taken on 13\-Nov\-05 at 22:58:31) to 20051113_225831.jpg
.sp 1
.nf
\fB$ exiv2 \-r'\:basename\:_%Y%m' rename img_1234.jpg\fP
.fi
Renames img_1234.jpg to img_1234_200511.jpg
.sp 1
.nf
\fB$ exiv2 \-et img1.jpg img2.jpg\fP
.fi
Extracts the Exif thumbnails from the two files into img1\-thumb.jpg
and img2\-thumb.jpg.
.sp 1
.nf
\fB$ exiv2 \-it img1.jpg img2.jpg\fP
.fi
Inserts (copies) metadata from img1.exv to img1.jpg and from img2.exv
to img2.jpg.
.sp 1
.nf
\fB$ exiv2 \-ep1,2 image.jpg\fP
.fi
Extracts previews 1 and 2 from image.jpg to the files image\-preview1.jpg
and image\-preview2.jpg.
.sp 1
.nf
\fB$ exiv2 \-eiX image.jpg\fP
.fi
Extracts IPTC datasets into an XMP sidecar file image.xmp and in the
process converts them to "IPTC Core" XMP schema.
.sp 1
.nf
\fB$ exiv2 \-iixX image.jpg\fP
.fi
Inserts IPTC and XMP metadata from an XMP sidecar file image.xmp into
image.jpg. The resulting IPTC datasets are converted from the "IPTC
Core" XMP schema properties in the sidecar file to the older IPTC IIM4
format. The inserted XMP properties include those in the "IPTC Core"
XMP schema.
.sp 1
.nf
\fB$ exiv2 \-M"set Exif.Photo.UserComment charset=Ascii New Exif comment" image.jpg\fP
.fi
Sets the Exif comment to an ASCII string.
.sp 1
.nf
\fB$ exiv2 \-M"set Exif.GPSInfo.GPSLatitude 4/1 15/1 33/1" \\ \-M"set Exif.GPSInfo.GPSLatitudeRef N" image.jpg\fP
.fi
Sets the latitude to 4 degrees, 15 minutes and 33 seconds north. The
Exif standard stipulates that the GPSLatitude tag consists of three
Rational numbers for the degrees, minutes and seconds of the latitude
and GPSLatitudeRef contains either 'N' or 'S' for north or south
latitude respectively.
.sp 1
.nf
\fB$ exiv2 \-l/tmp -S.CRW insert /data/*.JPG\fP
.fi
Copy all metadata from CRW files in the /tmp directory to JPG files
with corresponding basenames in the /data directory. Note that this
copies metadata as is, without any modifications to adapt it to the
requirements of the target format. Some tags copied like this may not
make sense in the target image.
.SH BUGS
Report bugs to: \fIhttps://github.com/Exiv2/exiv2/issues\fP
.SH COPYRIGHT
The Exiv2 project is released under the GNU GPLv2 license: \fIhttps://github.com/Exiv2/exiv2/blob/main/COPYING\fP
.SH SEE ALSO
.nf
\fBcurl\fP(1), \fBxmllint\fP(1), \fBiconv_open\fP(3), \fBstrftime\fP(3),
Exiv2 'modify' command examples: \fIhttps://exiv2.org/sample.html#modify\fP
All Exiv2 tags, listing the \fIkey\fP and default \fItype\fP: \fIhttps://exiv2.org/metadata.html\fP
Exiv2 sample programs: \fIhttps://github.com/Exiv2/exiv2/blob/main/README-SAMPLES.md\fP
APEX Exposure values: \fIhttps://en.wikipedia.org/wiki/APEX_system\fP
International Language Codes: \fIhttps://www.ietf.org/rfc/rfc3066.txt\fP
Windows INI format: \fIhttps://en.wikipedia.org/wiki/INI_file\fP
.fi
.SH AUTHORS
.B exiv2
was written by Andreas Huggel and others.
.br
Exiv2 project website: \fIhttps://exiv2.org\fP
.br
Exiv2 source code: \fIhttps://github.com/exiv2/exiv2\fP