EXIV2(1) | General Commands Manual | EXIV2(1) |
exiv2 - Image metadata manipulation tool
exiv2 [options] [action] file ...
exiv2 is a program to read and write Exif, IPTC, XMP
metadata and image comments and can read many vendor makernote tags. The
program optionally converts between Exif tags, XMP properties and IPTC
datasets as recommended by the Exif Standard, the IPTC Standard, the XMP
specification and Metadata Working Group guidelines.
The following image formats are supported:
Type | Exif | IPTC | XMP | Image comments |
JPEG | Read/Write | Read/Write | Read/Write | Read/Write |
EXV | Read/Write | Read/Write | Read/Write | Read/Write |
CR2 | Read/Write | Read/Write | Read/Write | - |
CRW | Read/Write | - | - | Read/Write |
MRW | Read | Read | Read | - |
TIFF | Read/Write | Read/Write | Read/Write | - |
DNG | Read/Write | Read/Write | Read/Write | - |
NEF | Read/Write | Read/Write | Read/Write | - |
PEF | Read/Write | Read/Write | Read/Write | - |
ARW | Read | Read | Read | - |
RW2 | Read | Read | Read | - |
SR2 | Read | Read | Read | - |
SRW | Read/Write | Read/Write | Read/Write | - |
ORF | Read/Write | Read/Write | Read/Write | - |
PNG | Read/Write | Read/Write | Read/Write | Read/Write |
PGF | Read/Write | Read/Write | Read/Write | Read/Write |
RAF | Read | Read | Read | - |
EPS | - | - | Read/Write | - |
XMP | - | - | Read/Write | - |
GIF | - | - | - | - |
PSD | Read/Write | Read/Write | Read/Write | - |
TGA | - | - | - | - |
BMP | - | - | - | - |
JP2 | Read/Write | Read/Write | Read/Write | - |
The action argument is only required if it is not clear from the options which action is implied.
exiv2 [ opt [arg] ]+ [ act ] file ... option [arg] long option description -a tim --adjust Modify time stamps. [+|-]HH[:MM[:SS[.mmm]]] -b --binary Show large binary values (default is to suppress them). -c txt --comment JPEG comment string to set in the image ('modify' action). ... -d tgt --delete Delete target(s) for the 'delete' action. ... -D +-n --days Time adjustment by a positive or negative number of days ... -e tgt --extract Extract target(s) for the 'extract' action. -f --force Do not prompt before overwriting existing files ... -F --Force Do not prompt before renaming files (Force rename) ... -g key --grep Only output info for this Exiv2 key (grep). -h --help Display help and exit. -i tgt --insert Insert target(s) for the 'insert' action. ... -k --keep Preserve file timestamps when updating files (keep) -K Key --key Report key. Similar to -g (grep) however key must match exactly. -l dir --location Location (directory) for files to be inserted or extracted. -m file --modify read commands from cmd-file -M cmd --Modify Command line for the 'modify' action. ... -n enc --encode Charset to decode Exif Unicode user comments. See: man 3 iconv_open -O +-n --months Time adjustment by a positive or negative number of months, ... -p mod --print Print report (common reports) -P flg --Print Print report (fine grained control) -q --quiet Silence warnings and error messages from the Exiv2 library ... -Q lvl --log Set the log-level to 'd'(ebug), 'i'(nfo), 'w'(arning), 'e'(rror) -r fmt --rename Filename format for the 'rename' action. ... -S suf --suffix Use suffix .suf for source files for insert command. -t --timestamp Set the file timestamp according to the Exif create timestamp ... -T --Timestamp Only set the file timestamp according to Exif create timestamp ... -u --unknown Show unknown tags ... -v --verbose verbose -V --version Show the program version and exit. -Y +-n --years Time adjustment by a positive or negative number of years ... act pr | ex | in | rm | ad | mo | mv | fi | fc print, extract, insert, delete, adjust, modify, rename, fixiso,fixcom cmd See "Commands" below. flg 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 fmt Default format is %Y%m%d_%H%M%S. lvl d | i | i | w | e debug, info, warning, error mod s | a | t | v | h | i | x | c | p | i | S | X : summary, add, translated, vanilla, hex ... iptc ,xmp, comment, preview, Structure,XMP raw tgt a | c | e | i | t | x all, comment, exif, iptc, thumb, xmp
exiv2 -g Date -pt R.jpg Exif.Image.DateTime Ascii 20 2012:08:07 16:01:05 Exif.Photo.DateTimeOriginal Ascii 20 2011:09:18 16:25:48 Exif.Photo.DateTimeDigitized Ascii 20 2011:09:18 16:25:48
exiv2 -K Exif.Photo.DateTimeDigitized -K Exif.Photo.DateTimeOriginal -pt R.jpg Exif.Photo.DateTimeOriginal Ascii 20 2011:09:18 16:25:48 Exif.Photo.DateTimeDigitized Ascii 20 2011:09:18 16:25:48
X : Insert metadata from an XMP sidecar file <file>.xmp.
The remaining insert targets determine what metadata to insert from the
sidecar file. Possible are Exif, IPTC and XMP and the default is all of
these. Note that the inserted XMP properties include those converted to
Exif and IPTC.
This is option is intended for "filter" operations on the XMP
such as:
$ exiv2 -e{tgt}- filename | xmllint .... | exiv2 -i{tgt}-
filename
Only JPEG thumbnails can be inserted (not TIFF thumbnails), they need to be named file-thumb.jpg.
X : Extract metadata to an XMP sidecar file <file>.xmp. The remaining extract targets determine what metadata to extract to the sidecar file. Possible are Exif, IPTC and XMP and the default is all of these.
- : Output sidecar file to stdout (see -i tgt for example)
Commands for the 'modify' action can be read from a command file, e.g.,
exiv2 -m cmd.txt image.jpg
or given on the command line, as in
exiv2 -M"add Iptc.Application2.Credit String Mr. Smith" image.jpg
Note the quotes. Multiple -m and -M options can be combined, and a non-standard XMP namespace registered.
exiv2 -M"reg myprefix http://ns.myprefix.me/" -M"add Xmp.myprefix.Whom Mr. Smith" -M"set Exif.Image.Artist Mr. Smith" image.jpg
When writing Exif, IPTC and XMP metadata, 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 exiv2 is able to read all metadata that it can write, other programs may have difficulties with images that contain non standard-conforming metadata.
The format of a command is
set | add | del key [[type] value]
A default type is used if none is explicitly given. The default is determined based on key.
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.
The format of Exif Comment values includes an optional
charset specification at the beginning:
[charset=Ascii|Jis|Unicode|Undefined ]comment
Undefined is used by default if the value doesn't start with a charset definition.
The format for an IPTC Date value is:
YYYY-MM-DD (year, month, day)
The format for an IPTC Time value is:
HH:MM:SS (hours, minutes, seconds)
and may optionally be followed by:
-HH:MM or +HH:MM (hours, minutes ahead/behind UTC)
The format of Rational (and SRational) is one
of:
integer
integer-numerator/integer-denominator
Fnumber
fnumber
Rational Examples:
exiv2 "-Mset Exif.Photo.MaxApertureValue 557429/62500" X.jpg
exiv2 "-Mset Exif.Photo.MaxApertureValue F5.6" X.jpg
The Rational format Fnumber (or fnumber) is for the convenience of setting aperture values. Aperture values are stored in Exif is an APEX value which can be evaluated by the expression:
apex-value = log(Fnumber) * 2.0 / log(2.0)
Fnumber = exp(apex-value * log(2.0) / 2.0)
The Rational format Fnumber is valid for any Rational, even when the key is not an Aperture. More information about APEX value is available from: http://en.wikipedia.org/wiki/APEX_system
The format of XMP LangAlt values includes an optional
language qualifier:
lang="language-code" text
lang="x-default" is used if the value doesn't start with a language qualifier.
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 All others pay cash' X.jpg
To remove a language specification, set the value to '' (empty
string)
exiv2 -M'set Xmp.dc.title lang="en-US"' X.jpg
To remove all language specifications, delete the key:
exiv2 -M'del Xmp.dc.title' X.jpg
Empty lines and lines starting with # in a command file are ignored (comments). Remaining lines are commands as described above.
-M"set Exif.GPSInfo.GPSLatitudeRef N" image.jpgSets 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.
exiv2 was written by Andreas Huggel and others. The Exiv2 project web site is http://exiv2.org
This manual page was originally created for the Debian project by KELEMEN Peter <fuji@debian.org>.
May 9, 2015 |