MAN page from RedHat EL 4 exiv2-0.19-1.el4.rf.i386.rpm


Section: User Commands (1)
Updated: Dec 29th, 2009


exiv2 - Image metadata manipulation tool 


exiv2[options] [action] file ...


exiv2is a program to read and write Exif, IPTC and XMP image metadata andimage comments. The following image formats are supported:
TypeExifIPTCXMPImage comments


Support for GIF, TGA and BMP images is minimal: the image format isrecognized, a MIME type assigned to it and the height and width of theimage are determined.
Reading other TIFF-like RAW image formats, which are not listed in thetable, may also work.


The action argument is only required if it is not clear from theoptions which action is implied.
pr | print
Print image metadata. This is the default action, i.e., the commandexiv2 image.jpg will print a summary of the image Exif metadata.
ex | extract
Extract metadata to *.exv, XMP sidecar (*.xmp) and thumbnail image files. Modification commands can be applied on-the-fly.
in | insert
Insert metadata from corresponding *.exv, XMP sidecar (*.xmp) andthumbnail files. Use option -S .suf to change the suffixof the input files. Since files of any supported format can be used asinput files, this command can be used to copy the metadata betweenfiles of different formats. Modification commands can be appliedon-the-fly.
rm | delete
Delete image metadata from the files.
ad | adjust
Adjust Exif timestamps by the given time. Requires at least one of theoptions -a time, -Y yrs, -Omon or -D day.
mo | modify
Apply commands to modify (add, set, delete) the Exif, IPTC and XMPmetadata of image files. Requires option -c, -m or-M.
mv | rename
Rename files and/or set file timestamps according to the Exif createtimestamp. Uses the value of tag Exif.Photo.DateTimeOriginal or, ifnot present, Exif.Image.DateTime to determine the timestamp. Thefilename format can be set with -r fmt, timestamp optionsare -t and -T.
fi | fixiso
Copy the ISO setting from one of the proprietary Nikon or Canonmakernote ISO tags to the regular Exif ISO tag,Exif.Photo.ISOSpeedRatings. Does not overwrite an existing standardExif ISO tag.


Display help and exit.
Show the program version and exit.
Be verbose during the program run.
Show large binary values (default is to suppress them).
Show unknown tags (default is to suppress tags which don't have a name).
Preserve file timestamps when updating files (keep). Can be used withall options which update files. The flag is ignored by read-onlyoptions.
Set the file timestamp according to the Exif create timestamp inaddition to renaming the file (overrides -k). This option isonly used with the 'rename' action.
Only set the file timestamp according to the Exif create timestamp, donot rename the file (overrides -k). This option is only usedwith the 'rename' action. Note: On Windows you may have to set the TZenvironment variable for this option to work correctly.
Do not prompt before overwriting existing files (force overwrite).
Do not prompt before renaming files (Force rename). Appends '_1' ('_2', ...) to the name of the new file.
-a time
Time adjustment in the format [-]HH[:MM[:SS]]. This option is onlyused with the 'adjust' action. Examples: 1 adds one hour, 1:01 adds one hour and one minute, -0:00:30 subtracts 30 seconds.
-Y yrs
Time adjustment by a positive or negative number of years, forthe 'adjust' action.
-O mon
Time adjustment by a positive or negative number of months, forthe 'adjust' action.
-D day
Time adjustment by a positive or negative number of days, forthe 'adjust' action.
-p mode
Print mode for the 'print' action. Possible modes are:
s : print a summary of the Exif metadata (the default)
a : print Exif, IPTC and XMP metadata (shortcut for -Pkyct)
t : interpreted (translated) Exif tags (-PEkyct)
v : plain Exif tag values (-PExgnycv)
h : hexdump of the Exif data (-PExgnycsh)
i : IPTC datasets (-PIkyct)
x : XMP properties (-PXkyct)
c : JPEG comment
p : list available image previews, sorted by preview image size in pixels
-P flgs
Print flags for fine control of the tag list ('print' action). Allowscontrol of the type of metadata as well as data columns included inthe print output. Valid flags are:
E : include Exif tags in the list
I : IPTC datasets
X : XMP properties
x : print a column with the tag number
g : group name
k : key
l : tag label
n : tag name
y : type
c : number of components (count)
s : size in bytes
v : plain data value
t : interpreted (translated) data
h : hexdump of the data
-d tgt
Delete target(s) for the 'delete' action. Possible targets are:
a : all supported metadata (the default)
e : Exif section
t : Exif thumbnail only
i : IPTC data
x : XMP packet
c : JPEG comment
-i tgt
Insert target(s) for the 'insert' action. Possible targets are thesame as those for the -d option, plus a modifier:
X : Insert metadata from an XMP sidecar file <file>.xmp. The remaininginsert targets determine what metadata to insert from the sidecarfile. Possible are Exif, IPTC and XMP and the default is all ofthese. Note that the inserted XMP properties include those convertedto Exif and IPTC.
Only JPEG thumbnails can be inserted (not TIFF thumbnails), they need to be named file-thumb.jpg.
-e tgt
Extract target(s) for the 'extract' action. Possible targets are the same as those for the -d option, plus a target to extract previewimages and a modifier to generate an XMP sidecar file:
p[<n>[,<m> ...]] : Extract preview images. The optional comma separatedlist of preview image numbers is used to determine which preview imagesto extract. The available preview images and their numbers are displayedwith the 'print' option -pp.
X : Extract metadata to an XMP sidecar file <file>.xmp. The remainingextract targets determine what metadata to extract to the sidecarfile. Possible are Exif, IPTC and XMP and the default is all of these.
-r fmt
Filename format for the 'rename' action. The format string followsstrftime(3) and supports the following keywords:
:basename: - original filename without extension
:dirname: - name of the directory holding the original file
:parentname: - name of parent directory
Default filename format is %Y%m%d_%H%M%S.
-c txt
JPEG comment string to set in the image ('modify' action). This optioncan also be used with the 'extract' and 'insert' actions to modifymetadata on-the-fly.
-m file
Command file for the 'modify' action. This option can also be usedwith the 'extract' and 'insert' actions to modify metadata on-the-fly.
-M cmd
Command line for the 'modify' action. This option can also be usedwith 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 acommand file.
-l dir
Location (directory) for files to be inserted or extracted.
-S .suf
Use suffix .suf for source files in 'insert' action.


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.

When writing Exif, IPTC and XMP metadata, exiv2 enforces only a correctmetadata structure. It is possible to write tags with types and valuesdifferent from those specified in the standards, duplicate Exif tags,undefined tags, or incomplete metadata. While exiv2 is able to readall metadata that it can write, other programs may have difficultieswith images that contain non standard-conforming metadata. 

Command format

The format of a command is

set | add | del key [[type] value]
Set the value of an existing tag with a matching key oradd the tag.
Add a tag (unless key is a non-repeatable IPTC key; nothingprevents you from adding duplicate Exif tags).
Delete all occurrences of a tag (requires only a key).
Exiv2 Exif or IPTC key.
Byte | Ascii | Short | Long | Rational | Undefined | SShort | SLong | SRational | Commentfor Exif keys,
String | Date | Time | Short | Undefinedfor IPTC keys, and
XmpText | XmpAlt | XmpBag | XmpSeq | LangAltfor XMP keys.

A default type is used if none is explicitely given. The defaultis determined based on key.

The remaining text on the line is the value. It can optionally beenclosed in single quotes ('value') or double quotes ("value").

The format of Exif Comment values includes an optional charsetspecification at the beginning:

[charset=Ascii|Jis|Unicode|Undefined ]comment

Undefined is used by default if the value doesn't start with a charsetdefinition.

The format for IPTC Date values is YYYY-MM-DD (year, month, day),that for IPTC Time values is HH:MM:SS+|-HH:MM, where HH:MM:SSrefers to local hour, minute and seconds and +|-HH:MM refers to hoursand minutes ahead or behind Universal Coordinated Time (+|- meanseither a + or a - sign is required).

The format of XMP LangAlt values includes an optional languagequalifier:

[lang=language-code ]text

x-defaultis used by default if the value doesn't start with a language qualifier.

An additional command is available to register XMP namespaces:
reg prefix namespace

Command file format

Empty lines and lines starting with # in a command file areignored (comments). Remaining lines are commands as described above. 


exiv2 *.jpg
Prints a summary of the Exif information for all JPEG files in the directory.
exiv2 -pi image.jpg
Prints the IPTC metadata of the image.
exiv2 rename img_1234.jpg
Renames img_1234.jpg (taken on 13-Nov-05 at 22:58:31) to 20051113_225831.jpg
exiv2 -r':basename:_%Y%m' rename img_1234.jpg
Renames img_1234.jpg to img_1234_200511.jpg
exiv2 -et img1.jpg img2.jpg
Extracts the Exif thumbnails from the two files into img1-thumb.jpgand img2-thumb.jpg.
exiv2 -it img1.jpg img2.jpg
Inserts (copies) metadata from img1.exv to img1.jpg and from img2.exvto img2.jpg.
exiv2 -ep1,2 image.jpg
Extracts previews 1 and 2 from the image to the files image-preview1.jpgand image-preview2.jpg.
exiv2 -eiX image.jpg
Extracts IPTC datasets into an XMP sidecar file image.xmp and in theprocess converts them to "IPTC Core" XMP schema.
exiv2 -iixX image.jpg
Inserts IPTC and XMP metadata from an XMP sidecar file image.xmp intoimage.jpg. The resulting IPTC datasets are converted from the "IPTCCore" XMP schema properties in the sidecar file to the older IPTC IIM4format. The inserted XMP properties include those in the "IPTC Core"XMP schema.
exiv2 -M"set Exif.Photo.UserComment charset=Ascii New Exif comment" image.jpg
Sets the Exif comment to an ASCII string.
exiv2 -M"set Exif.GPSInfo.GPSLatitude 4/1 15/1 33/1" \-M"set Exif.GPSInfo.GPSLatitudeRef N" image.jpg
Sets the latitude to 4 degrees, 15 minutes and 33 seconds north. TheExif standard stipulates that the GPSLatitude tag consists of threeRational numbers for the degrees, minutes and seconds of the latitudeand GPSLatitudeRef contains either 'N' or 'S' for north or southlatitude respectively.
exiv2 insert -l/tmp -S.CRW /data/*.JPG
Copy all metadata from CRW files in the /tmp directory to JPG fileswith corresponding basenames in the /data directory. Note that thiscopies metadata as is, without any modifications to adapt it to therequirements of the target format. Some tags copied like this may notmake sense in the target image.

Sample command files.
Taglists with key and default type values.


exiv2 was written by Andreas Huggel <>.

This manual page was originally written by KELEMEN Peter <>,for the Debian project.



Command format
Command file format

This document was created byman2html,using the manual pages.