By default, the utility prints a summary of the Exif information

$ exiv2 img_1771.jpg

File name       : img_1771.jpg
File size       : 32764 Bytes
MIME type       : image/jpeg
Image size      : 480 x 360
Thumbnail       : image/jpeg, 5448 Bytes
Camera make     : Canon
Camera model    : Canon PowerShot S40
Image timestamp : 2003:12:14 12:01:44
File number     : 117-1771
Exposure time   : 1/500 s
Aperture        : F4.9
Exposure bias   : 0 EV
Flash           : No, auto
Flash bias      : 0 EV
Focal length    : 21.3 mm
Subject distance: 7.82 m
ISO speed       : 100
Exposure mode   : Program (P)
Metering mode   : Center weighted average
Macro mode      : Off
Image quality   : Superfine
White balance   : Auto
Copyright       : 
Exif comment    : 


    

 

Image with the Exif data shown in the sample output

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

Exif.Image.Make                              Ascii       6  Canon
Exif.Image.Model                             Ascii      20  Canon PowerShot S40
Exif.Image.Orientation                       Short       1  top, left
Exif.Image.XResolution                       Rational    1  180
Exif.Image.YResolution                       Rational    1  180
Exif.Image.ResolutionUnit                    Short       1  inch
Exif.Image.DateTime                          Ascii      20  2003:12:14 12:01:44
Exif.Image.YCbCrPositioning                  Short       1  Centered
Exif.Image.ExifTag                           Long        1  196
Exif.Photo.ExposureTime                      Rational    1  1/500 s
Exif.Photo.FNumber                           Rational    1  F4.9
Exif.Photo.ExifVersion                       Undefined   4  2.20
Exif.Photo.DateTimeOriginal                  Ascii      20  2003:12:14 12:01:44
Exif.Photo.DateTimeDigitized                 Ascii      20  2003:12:14 12:01:44
Exif.Photo.ComponentsConfiguration           Undefined   4  YCbCr
Exif.Photo.CompressedBitsPerPixel            Rational    1  5
Exif.Photo.ShutterSpeedValue                 SRational   1  1/501 s
Exif.Photo.ApertureValue                     Rational    1  F5
Exif.Photo.ExposureBiasValue                 SRational   1  0 EV
Exif.Photo.MaxApertureValue                  Rational    1  F2.8
Exif.Photo.MeteringMode                      Short       1  Center weighted average
Exif.Photo.Flash                             Short       1  No, auto
Exif.Photo.FocalLength                       Rational    1  21.3 mm
Exif.Photo.MakerNote                         Undefined 450  12 0 1 0 3 0 40 0 0 0 68 4 0 0 2 0 3 0 4 0 0 0 148 4 0 0 3 0 3 0 4 0 0 0 156 4 0 0 4 0 3 0 27 0 0 0 164 4 0 0 0 0 3 0 6 0 0 0 218 4 0 0 0 0 3 0 4 0 0 0 230 4 0 0 6 0 2 0 32 0 0 0 238 4 0 0 7 0 2 0 24 0 0 0 14 5 0 0 8 0 4 0 1 0 0 0 59 225 17 0 9 0 2 0 32 0 0 0 38 5 0 0 16 0 4 0 1 0 0 0 0 0 17 1 13 0 3 0 21 0 0 0 70 5 0 0 0 0 0 0 80 0 2 0 0 0 5 0 1 0 0 0 0 0 4 0 0 0 1 0 0 0 1 0 0 0 0 0 0 0 0 0 17 0 5 0 1 0 3 48 1 0 255 255 255 255 170 2 227 0 32 0 149 0 192 0 0 0 0 0 0 0 0 0 0 0 0 0 255 255 49 0 224 8 224 8 0 0 1 0 2 0 170 2 30 1 215 0 0 0 0 0 0 0 0 0 54 0 0 0 160 0 20 1 149 0 31 1 0 0 0 0 0 0 0 0 6 0 0 0 0 0 0 0 2 48 0 0 0 0 0 0 1 0 14 3 0 0 149 0 33 1 0 0 0 0 0 0 250 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 73 77 71 58 80 111 119 101 114 83 104 111 116 32 83 52 48 32 74 80 69 71 0 0 0 0 0 0 0 0 0 0 70 105 114 109 119 97 114 101 32 86 101 114 115 105 111 110 32 49 46 49 48 0 0 0 65 110 100 114 101 97 115 32 72 117 103 103 101 108 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 42 0 3 0 1 128 122 1 1 128 0 0 0 0 0 0 3 1 2 0 0 0 10 0 0 0 0 0 0 0 57 0 198 0 5 0 0 0 0 0 0 0
Exif.MakerNote.Offset                        Long        1  942
Exif.MakerNote.ByteOrder                     Ascii       3  II
Exif.CanonCs.Macro                           Short       1  Off
Exif.CanonCs.Selftimer                       Short       1  Off
Exif.CanonCs.Quality                         Short       1  Superfine
Exif.CanonCs.FlashMode                       Short       1  Auto
Exif.CanonCs.DriveMode                       Short       1  Single / timer
Exif.CanonCs.FocusMode                       Short       1  Single
Exif.CanonCs.RecordMode                      Short       1  JPEG
Exif.CanonCs.ImageSize                       Short       1  Large
Exif.CanonCs.EasyMode                        Short       1  Manual
Exif.CanonCs.DigitalZoom                     Short       1  None
Exif.CanonCs.Contrast                        Short       1  Normal
Exif.CanonCs.Saturation                      Short       1  Normal
Exif.CanonCs.Sharpness                       Short       1  Normal
Exif.CanonCs.ISOSpeed                        Short       1  100
Exif.CanonCs.MeteringMode                    Short       1  Center-weighted average
Exif.CanonCs.FocusType                       Short       1  Auto
Exif.CanonCs.AFPoint                         Short       1  Center
Exif.CanonCs.ExposureProgram                 Short       1  Program (P)
Exif.CanonCs.LensType                        Short       1  n/a
Exif.CanonCs.Lens                            Short       3  7.1 - 21.3 mm
Exif.CanonCs.MaxAperture                     Short       1  F5
Exif.CanonCs.MinAperture                     Short       1  F8
Exif.CanonCs.FlashActivity                   Short       1  Did not fire
Exif.CanonCs.FlashDetails                    Short       1  
Exif.CanonCs.FocusContinuous                 Short       1  Single
Exif.CanonCs.AESetting                       Short       1  Normal AE
Exif.CanonCs.ImageStabilization              Short       1  (65535)
Exif.CanonCs.DisplayAperture                 Short       1  49
Exif.CanonCs.ZoomSourceWidth                 Short       1  2272
Exif.CanonCs.ZoomTargetWidth                 Short       1  2272
Exif.CanonCs.SpotMeteringMode                Short       1  AF Point
Exif.Canon.FocalLength                       Short       4  21.3 mm
Exif.CanonSi.AutoISO                         Short       1  100
Exif.CanonSi.ISOSpeed                        Short       1  100
Exif.CanonSi.MeasuredEV                      Short       1  13.63
Exif.CanonSi.TargetAperture                  Short       1  F5
Exif.CanonSi.TargetShutterSpeed              Short       1  1/501 s
Exif.CanonSi.WhiteBalance                    Short       1  Auto
Exif.CanonSi.SlowShutter                     Short       1  Off
Exif.CanonSi.Sequence                        Short       1  0
Exif.CanonSi.CameraTemperature               Short       1  --
Exif.CanonSi.FlashGuideNumber                Short       1  0
Exif.CanonSi.AFPointUsed                     Short       1  3 focus points; center used
Exif.CanonSi.FlashBias                       Short       1  0 EV
Exif.CanonSi.AutoExposureBracketing          Short       1  Off
Exif.CanonSi.SubjectDistance                 Short       1  7.82 m
Exif.CanonSi.ApertureValue                   Short       1  F5
Exif.CanonSi.ShutterSpeedValue               Short       1  1/523 s
Exif.CanonSi.MeasuredEV2                     Short       1  -6.00
Exif.CanonSi.BulbDuration                    Short       1  0
Exif.CanonSi.CameraType                      Short       1  Compact
Exif.Canon.ImageType                         Ascii      32  IMG:PowerShot S40 JPEG
Exif.Canon.FirmwareVersion                   Ascii      24  Firmware Version 1.10
Exif.Canon.FileNumber                        Long        1  117-1771
Exif.Canon.OwnerName                         Ascii      32  Andreas Huggel
Exif.Canon.ModelID                           Long        1  PowerShot S40
Exif.Canon.CameraInfo                        Short      21  42 3 32769 378 32769 0 0 0 259 2 0 10 0 0 0 57 198 5 0 0 0
Exif.Photo.UserComment                       Undefined 264  
Exif.Photo.FlashpixVersion                   Undefined   4  1.00
Exif.Photo.ColorSpace                        Short       1  sRGB
Exif.Photo.PixelXDimension                   Short       1  2272
Exif.Photo.PixelYDimension                   Short       1  1704
Exif.Photo.InteroperabilityTag               Long        1  1416
Exif.Iop.InteroperabilityIndex               Ascii       4  R98
Exif.Iop.InteroperabilityVersion             Undefined   4  1.00
Exif.Iop.RelatedImageWidth                   Short       1  2272
Exif.Iop.RelatedImageLength                  Short       1  1704
Exif.Photo.FocalPlaneXResolution             Rational    1  8114.29
Exif.Photo.FocalPlaneYResolution             Rational    1  8114.29
Exif.Photo.FocalPlaneResolutionUnit          Short       1  inch
Exif.Photo.SensingMethod                     Short       1  One-chip color area
Exif.Photo.FileSource                        Undefined   1  Digital still camera
Exif.Photo.CustomRendered                    Short       1  Normal process
Exif.Photo.ExposureMode                      Short       1  Auto
Exif.Photo.WhiteBalance                      Short       1  Auto
Exif.Photo.DigitalZoomRatio                  Rational    1  1.0
Exif.Photo.SceneCaptureType                  Short       1  Standard
Exif.Thumbnail.Compression                   Short       1  JPEG (old-style)
Exif.Thumbnail.XResolution                   Rational    1  180
Exif.Thumbnail.YResolution                   Rational    1  180
Exif.Thumbnail.ResolutionUnit                Short       1  inch
Exif.Thumbnail.JPEGInterchangeFormat         Long        1  2036
Exif.Thumbnail.JPEGInterchangeFormatLength   Long        1  5448

 

Short description of the actions and options supported by the Exiv2 utility (see the man page for details)

$ exiv2 -h

Usage: exiv2 [ options ] [ action ] file ...

Manipulate the Exif metadata of images.

Actions:
  ad | adjust   Adjust Exif timestamps by the given time. This action
                requires at least one of the -a, -Y, -O or -D options.
  pr | print    Print image metadata.
  rm | delete   Delete image metadata from the files.
  in | insert   Insert metadata from corresponding *.exv files.
                Use option -S to change the suffix of the input files.
  ex | extract  Extract metadata to *.exv, *.xmp and thumbnail image files.
  mv | rename   Rename files and/or set file timestamps according to the
                Exif create timestamp. The filename format can be set with
                -r format, timestamp options are controlled with -t and -T.
  mo | modify   Apply commands to modify (add, set, delete) the Exif and
                IPTC metadata of image files or set the JPEG comment.
                Requires option -c, -m or -M.
  fi | fixiso   Copy ISO setting from the Nikon Makernote to the regular
                Exif tag.
  fc | fixcom   Convert the UNICODE Exif user comment to UCS-2. Its current
                character encoding can be specified with the -n option.

Options:
   -h      Display this help and exit.
   -V      Show the program version and exit.
   -v      Be verbose during the program run.
   -q      Silence warnings and error messages during the program run (quiet).
   -Q lvl  Set log-level to d(ebug), i(nfo), w(arning), e(rror) or m(ute).
   -b      Show large binary values.
   -u      Show unknown tags.
   -g key  Only output info for this key (grep).
   -K key  Only output info for this key (exact match).
   -n enc  Charset to use to decode UNICODE Exif user comments.
   -k      Preserve file timestamps (keep).
   -t      Also set the file timestamp in 'rename' action (overrides -k).
   -T      Only set the file timestamp in 'rename' action, do not rename
           the file (overrides -k).
   -f      Do not prompt before overwriting existing files (force).
   -F      Do not prompt before renaming files (Force).
   -a time Time adjustment in the format [-]HH[:MM[:SS]]. This option
           is only used with the 'adjust' action.
   -Y yrs  Year adjustment with the 'adjust' action.
   -O mon  Month adjustment with the 'adjust' action.
   -D day  Day adjustment with the '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)
             e : print Exif metadata (shortcut for -PEkycv)
             t : interpreted (translated) Exif data (-PEkyct)
             v : plain Exif data values (-PExgnycv)
             h : hexdump of the Exif data (-PExgnycsh)
             i : IPTC data values (-PIkyct)
             x : XMP properties (-PXkyct)
             c : JPEG comment
             p : list available previews
             C : print ICC profile embedded in image
             R : recursive print structure of image
             S : print structure of image
             X : extract XMP from image
   -P flgs Print flags for fine control of tag lists ('print' action):
             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
           the same as those for the -d option, plus a modifier:
             X : Insert metadata from an XMP sidecar file <file>.xmp
           Only JPEG thumbnails can be inserted, 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
           preview images and a modifier to generate an XMP sidecar file:
             p[<n>[,<m> ...]] : Extract preview images.
             X : Extract metadata to an XMP sidecar file <file>.xmp
   -r fmt  Filename format for the 'rename' action. The format string
           follows strftime(3). The following keywords are supported:
             :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.
   -m file Command file for the modify action. The format for commands is
           set|add|del <key> [[<type>] <value>].
   -M cmd  Command line for the modify action. The format for the
           commands is the same as that of the lines of a command file.
   -l dir  Location (directory) for files to be inserted from or extracted to.
   -S .suf Use suffix .suf for source files for insert command.


 

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 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

 

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 qualifier 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