__doctype__ __header4__
__navbar__By default, the utility prints a summary of the Exif information
$ exiv2 img_1771.jpg
__sample-p__
Image with the Exif data shown in the sample output
With the -pt
option, the utility prints out all Exif information as interpreted (translated) values. Alternatively, -pv
prints the plain Exif data values.
$ exiv2 -pt img_1771.jpg
__sample-pt__
Short description of the actions and options supported by the Exiv2 utility (see the man page for details)
$ exiv2 -h
__sample-h__
You can modify any Exif or IPTC metadata using modify-commands from a file (-m
option) or directly from the command line (-M
option). Multiple -M
and -m
directives can be combined. Here is a sample command file for the modify option (lines starting with #
are comments)
# Sample Exiv2 command file
# -------------------------
#
# $ exiv2 -m cmd.txt file ...
#
# to apply the commands in cmd.txt to each file. Alternatively, commands can be
# run from the command line directly, without a command file:
#
# $ exiv2 -M"add Iptc.Application2.Credit String mee too!" file ...
#
# Note the quotes. Multiple -m and -M options are allowed and can be combined.
#
# Command file format
# -------------------
# Empty lines and lines starting with # are ignored
# Each remaining line is a command. The format for command lines is
# <cmd> <key> [[<type>] <value>]
# cmd = set|add|del
# set will set the value of an existing tag of the given key or add a tag
# add will add a tag (unless the key is a non-repeatable IPTC key)
# del will delete a tag
# key = Exiv2 Exif or IPTC key
# type =
# Byte|Ascii|Short|Long|Rational|Undefined|SShort|SLong|SRational|Comment
# for Exif keys, and
# String|Date|Time|Short|Undefined for IPTC keys
# The format for IPTC Date values is YYYY-MM-DD (year, month, day) and
# for IPTC Time values it is HH:MM:SS±HH:MM where HH:MM:SS refers to local
# hour, minute and seconds and ±HH:MM refers to hours and minutes ahead or
# behind Universal Coordinated Time.
# A default type is used if none is explicitely given. The default type
# is determined based on the key.
# value
# The remaining text on the line is the value. It can optionally be enclosed in
# double quotes ("value")
#
add Iptc.Application2.Credit String "mee too! (1)"
add Iptc.Application2.Credit mee too! (2)
del Iptc.Application2.Headline
set Iptc.Application2.Headline Filename
add Exif.Image.WhitePoint Short 32 12 4 5 6
set Exif.Image.DateTime Ascii "Zwanzig nach fuenf"
set Exif.Image.Artist Ascii nobody
set Exif.Image.Artist "Vincent van Gogh"
set Exif.Photo.UserComment Comment charset=Ascii This is an ASCII Exif comment
The following commands are for XMP tags, the result is the same as that of Example 5.
# Sample Exiv2 command file for XMP tags
# --------------------------------------
# Set basic properties. Exiv2 uses the value type of the XMP specification
# for the property, if it is not specified. The default XMP value type
# for unknown properties is a simple text value.
# A simple text property.
set Xmp.dc.source xmpsample.cpp
# An array item (unordered array).
set Xmp.dc.subject "Palmtree"
# Add a 2nd array item
set Xmp.dc.subject "Rubbertree"
# A language alternative (without a default)
set Xmp.dc.title lang=en-US Sunset on the beach
set Xmp.dc.title lang=de-DE Sonnenuntergang am Strand
# Any properties can be set provided the namespace is known.
set Xmp.dc.one -1
set Xmp.dc.two 3.1415
set Xmp.dc.three 5/7
set Xmp.dc.four 255
set Xmp.dc.five 256
set Xmp.dc.six false
set Xmp.dc.seven Seven
# The value type can be specified. Exiv2 has support for a limited number
# of specific XMP types with built-in types: The basic XmpText, array
# types XmpAlt (alternative array), XmpBag (unordered array), XmpSeq
# (ordered array) and language alternatives LangAlt.
# Simple text property with explicitly specified value type
set Xmp.dc.format XmpText "image/jpeg"
# An ordered array
set Xmp.dc.creator XmpSeq "1) The first creator"
set Xmp.dc.creator "2) The second creator"
set Xmp.dc.creator "3) And another one"
# A language alternative. The default entry of a langauge alternative
# doesn't need a language qualifier.
set Xmp.dc.description LangAlt lang=de-DE Hallo, Welt
set Xmp.dc.description LangAlt Hello, World
# According to the XMP specification, Xmp.tiff.ImageDescription is an
# alias for Xmp.dc.description. Exiv2 treats an alias just like any
# other property.
set Xmp.tiff.ImageDescription TIFF image description
set Xmp.tiff.ImageDescription lang=de-DE TIFF Bildbeschreibung
# Register a namespace which Exiv2 doesn't know yet with a prefix.
reg ns myNamespace/
# There are no built-in Exiv2 value types for structures, qualifiers and
# nested types. However, these can be added by using an XmpText value and a
# path as the key.
# Add a structure
set Xmp.xmpDM.videoFrameSize/stDim:w 16
set Xmp.xmpDM.videoFrameSize/stDim:h 9
set Xmp.xmpDM.videoFrameSize/stDim:unit inch
# Add an element with a qualifier (using the namespace registered earlier)
set Xmp.dc.publisher James Bond
set Xmp.dc.publisher/?ns:role secret agent
# Add a qualifer to an array element of Xmp.dc.creator (added above)
set Xmp.dc.creator[2]/?ns:role programmer
# Add an array of structures. First set a text property with just the
# array type. (Note: this is not the same as creating an XmpBag property.)
set Xmp.xmpBJ.JobRef XmpText type=Bag
# Then set the array items. Each of them is a structure with two elements.
set Xmp.xmpBJ.JobRef[1]/stJob:name XmpText Birthday party
set Xmp.xmpBJ.JobRef[1]/stJob:role XmpText Photographer
set Xmp.xmpBJ.JobRef[2]/stJob:name Wedding ceremony
set Xmp.xmpBJ.JobRef[2]/stJob:role Best man