__doctype__
<html lang="en">
__header4__
<body>
__navbar__

<div class="container">
  <div class="page-header">
    <h1>Command line utility examples</h1>
  </div>

<div class="row">
  <div class="col-md-6">
    <p>By default, the utility prints a summary of the Exif information</p> 
    <pre>
<span class="stringliteral">$ exiv2 img_1771.jpg</span>

__sample-p__
    </pre>
  </div><!-- /.col-md-6 -->
  <div class="col-md-6">
    <p>&nbsp;</p>
    <img src="include/img_1771.jpg" class="img-responsive img-rounded center-block" title="img_1771.jpg (32764 Bytes)" alt="Image with the Exif data shown in the sample output">
    <p class="text-center text-muted"><em>Image with the Exif data shown in the sample output</em></p>
  </div><!-- /.col-md-6 -->
</div><!-- /.row -->

<p>&nbsp;</p>
<p>With the <code>-pt</code> option, the utility prints out all Exif information as interpreted (translated) values. Alternatively, <code>-pv</code> prints the plain Exif data values.</p> 

<pre>
<span class="stringliteral">$ exiv2 -pt img_1771.jpg</span>

__sample-pt__
</pre>

<p>&nbsp;</p>
<p>Short description of the actions and options supported by the Exiv2 utility 
(see the <a href="manpage.html" title="Exiv2 man page">man page</a> for details)</p>

<a name="usage"></a><pre>
<span class="stringliteral">$ exiv2 -h</span>

__sample-h__
</pre>

<p>&nbsp;</p>
<p id="modify">You can modify any Exif or IPTC metadata using modify-commands from a file (<code>-m</code> option) or directly from the command line (<code>-M</code> option). Multiple <code>-M</code> and <code>-m</code> directives can be combined. Here is a sample command file for the modify option (lines starting with <code>#</code> are comments)</p>

<pre>
<span class="comment"># Sample Exiv2 command file</span>
# -------------------------
#
# $ 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
# &lt;cmd&gt; &lt;key&gt; [[&lt;type&gt;] &lt;value&gt;] 
# 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&plusmn;HH:MM where HH:MM:SS refers to local 
#    hour, minute and seconds and &plusmn;HH:MM refers to hours and minutes ahead or 
#    behind Universal Coordinated Time.
#    A default type is used if none is explicitly 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
</pre>

<p>&nbsp;</p>
<p id="xmp">The following commands are for XMP tags, 
the <a href="example5.html#output">result</a> 
is the same as that of Example 5.</p>

<pre>
<span class="comment"># Sample Exiv2 command file for XMP tags</span>
# --------------------------------------

# 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

</pre>

</div><!-- /.container -->
__footer__
__bootstrap__
</body>
</html>
