1EXIV2SAMPLES(1)             General Commands Manual            EXIV2SAMPLES(1)
2
3
4

NAME

6       exiv2 sample applications- Image metadata manipulation tool
7

SYNOPSIS

9       exiv2 [options] [action] file ...
10

DESCRIPTION

12       exiv2 is a program to read and write Exif, IPTC, XMP metadata and image
13       comments and can read many vendor  makernote  tags.   Users  who  build
14       exiv2 and its library also build some sample and test applications.
15       The samples are:
16       exiv2json Format metadata in json
17       exifprint Print the metadata in one or more images
18       The following image formats are supported:
19
20       Type   Exif         IPTC         XMP          Image comments
21       ─────────────────────────────────────────────────────────────
22       JPEG   Read/Write   Read/Write   Read/Write   Read/Write
23       EXV    Read/Write   Read/Write   Read/Write   Read/Write
24       CR2    Read/Write   Read/Write   Read/Write   -
25       CRW    Read/Write   -            -            Read/Write
26       MRW    Read         Read         Read         -
27       TIFF   Read/Write   Read/Write   Read/Write   -
28       DNG    Read/Write   Read/Write   Read/Write   -
29       NEF    Read/Write   Read/Write   Read/Write   -
30       PEF    Read/Write   Read/Write   Read/Write   -
31       ARW    Read         Read         Read         -
32       RW2    Read         Read         Read         -
33       SR2    Read         Read         Read         -
34       SRW    Read/Write   Read/Write   Read/Write   -
35       ORF    Read/Write   Read/Write   Read/Write   -
36       PNG    Read/Write   Read/Write   Read/Write   Read/Write
37       PGF    Read/Write   Read/Write   Read/Write   Read/Write
38       RAF    Read         Read         Read         -
39       EPS    -            -            Read/Write   -
40       XMP    -            -            Read/Write   -
41       GIF    -            -            -            -
42       PSD    Read/Write   Read/Write   Read/Write   -
43       TGA    -            -            -            -
44       BMP    -            -            -            -
45       JP2    Read/Write   Read/Write   Read/Write   -
46
47       · Support  for  GIF, TGA and BMP images is minimal: the image format is
48         recognized, a MIME type assigned to it and the height  and  width  of
49         the image are determined.
50
51       · Reading  other  TIFF-like  RAW image formats, which are not listed in
52         the table, may also work.
53

ACTIONS

55       The action argument is only required  if  it  is  not  clear  from  the
56       options which action is implied.
57
58       pr | print
59              Print image metadata. This is the default action, i.e., the com‐
60              mand exiv2 image.jpg will print a  summary  of  the  image  Exif
61              metadata.
62
63       ex | extract
64              Extract  metadata  to  *.exv,  XMP sidecar (*.xmp) and thumbnail
65              image files.  Modification commands can be applied on-the-fly.
66
67       in | insert
68              Insert metadata from corresponding *.exv,  XMP  sidecar  (*.xmp)
69              and thumbnail files.  Use option -S .suf to change the suffix of
70              the input files. Since files of any supported format can be used
71              as  input  files,  this command can be used to copy the metadata
72              between files of different formats. Modification commands can be
73              applied on-the-fly.
74
75       rm | delete
76              Delete image metadata from the files.
77
78       ad | adjust
79              Adjust  Exif timestamps by the given time. Requires at least one
80              of the options -a time, -Y yrs, -O mon or -D day.
81
82       mo | modify
83              Apply commands to modify (add, set, delete) the Exif,  IPTC  and
84              XMP metadata of image files. Requires option -c, -m or -M.
85
86       mv | rename
87              Rename  files  and/or  set file timestamps according to the Exif
88              create timestamp. Uses the value of tag Exif.Photo.DateTimeOrig‐
89              inal  or,  if  not present, Exif.Image.DateTime to determine the
90              timestamp. The filename format can be set with -r fmt, timestamp
91              options are -t and -T.
92
93       fi | fixiso
94              Copy  the ISO setting from one of the proprietary Nikon or Canon
95              makernote   ISO   tags   to   the   regular   Exif   ISO    tag,
96              Exif.Photo.ISOSpeedRatings. Does not overwrite an existing stan‐
97              dard Exif ISO tag.
98
99       fc | fixcom
100              Fix the  character  encoding  of  Exif  Unicode  user  comments.
101              Decodes the comment using the auto-detected or specified charac‐
102              ter encoding and writes it back in UCS-2. Use option -n to spec‐
103              ify the current encoding of the comment if necessary.
104

COMMAND SUMMARY

106       exiv2 [ opt [arg] ]+ [ act ] file ...
107
108       option [arg]     long option  description
109       -a  tim          --adjust     Modify time stamps.  [+|-]HH[:MM[:SS[.mmm]]]
110       -b               --binary     Show large binary values (default is to suppress them).
111       -c  txt          --comment    JPEG comment string to set in the image ('modify' action).  ...
112       -d  tgt          --delete     Delete target(s) for the 'delete' action. ...
113       -D  +-n          --days       Time  adjustment by a positive or negative number of days ...
114       -e  tgt          --extract    Extract target(s) for the 'extract' action.
115       -f               --force      Do not prompt before overwriting existing  files ...
116       -F               --Force      Do not prompt before renaming files (Force rename) ...
117       -g  key          --grep       Only output info for this Exiv2 key (grep).
118       -h               --help       Display help and exit.
119       -i  tgt          --insert     Insert target(s) for the 'insert' action. ...
120       -k               --keep       Preserve file timestamps when updating files (keep)
121       -K  Key          --key        Report key.  Similar to -g (grep) however key must match exactly.
122       -l  dir          --location   Location (directory) for files to be inserted or extracted.
123       -m  file         --modify     read commands from cmd-file
124       -M  cmd          --Modify     Command line for the 'modify' action. ...
125       -n  enc          --encode     Charset to decode Exif Unicode user comments. See: man 3 iconv_open
126       -O  +-n          --months     Time adjustment by a positive or negative number of months, ...
127       -p  mod          --print      Print report (common reports)
128       -P  flg          --Print      Print report (fine grained control)
129       -q               --quiet      Silence warnings and error messages from the Exiv2 library ...
130       -Q  lvl          --log        Set the log-level to 'd'(ebug), 'i'(nfo), 'w'(arning), 'e'(rror)
131       -r  fmt          --rename     Filename format for the 'rename' action. ...
132       -S  suf          --suffix     Use suffix .suf for source files for insert command.
133       -t               --timestamp  Set the file timestamp according to the Exif create timestamp ...
134       -T               --Timestamp  Only set the file timestamp according to Exif create timestamp ...
135       -u               --unknown    Show unknown tags ...
136       -v               --verbose    verbose
137       -V               --version    Show the program version and exit.
138       -Y  +-n          --years      Time adjustment by a positive or negative number of years ...
139
140       act              pr | ex | in | rm | ad | mo | mv | fi | fc
141                        print, extract, insert, delete, adjust, modify, rename, fixiso,fixcom
142
143       cmd              See "Commands" below.
144
145       flg              E | I | X | x | g | k | l | n | y | c | s | v | t | h
146                        Exif , IPTC, XMP, num, grp, key, label, name , type, count, size, vanilla, translated, hex
147
148       fmt              Default format is %Y%m%d_%H%M%S.
149
150       lvl              d | i | i | w | e
151                        debug, info, warning, error
152
153       mod              s | a | t | v | h | i | x | c | p | i | S | X :
154                        summary, add, translated, vanilla, hex ...
155                        iptc ,xmp, comment, preview, Structure,XMP raw
156
157       tgt              a | c | e | i | t | x
158                        all, comment, exif, iptc, thumb, xmp
159
160

OPTIONS

162       -h     Display help and exit.
163
164       -V     Show the program version and exit.
165              When -V is combined with -v (Verbose version), build information
166              is printed to standard  output  along  with  a  list  of  shared
167              libraries which have been loaded into memory. Verbose version is
168              supported on Windows (MSVC, Cygwin and MinGW builds), MacOSX and
169              Linux and is provided for test and debugging.
170
171       -v     Be verbose during the program run.
172
173       -q     Silence  warnings and error messages from the Exiv2 library dur‐
174              ing the program run (quiet). Note that options -v and -q can  be
175              used at the same time.
176
177       -Q lvl Set the log-level to 'd'(ebug), 'i'(nfo), 'w'(arning), 'e'(rror)
178              or 'm'(ute). The default log-level is 'w'. -Qm is equivalent  to
179              -q. All log messages are written to standard error.
180
181       -b     Show large binary values (default is to suppress them).
182
183       -u     Show  unknown tags (default is to suppress tags which don't have
184              a name).
185
186       -g key Only keys which match the given key (grep).
187              Multiple -g options can be used to grep info for  several  keys.
188              When  the  library  is  build with C++11, keys are matched using
189              std::regex::extended.  When build without C++11, keys  are  pro‐
190              cessed  with  the  system  regular expression engine:  see man 3
191              regex.  Platforms which do not support regex use key for a  sub‐
192              string match.  You can determine the availability of regex using
193              the command: exiv2 -v -V -g have_regex -g cplusplus.
194
195              exiv2 -g Date -pt R.jpg
196              Exif.Image.DateTime           Ascii      20  2012:08:07 16:01:05
197              Exif.Photo.DateTimeOriginal   Ascii      20  2011:09:18 16:25:48
198              Exif.Photo.DateTimeDigitized  Ascii      20  2011:09:18 16:25:48
199
200              -g (--grep) is only  applied  to  keys.   It  is  not  generally
201              applied to all output such as the default -ps report.
202
203              The  key  may  finish with the optional modifier /i to indicated
204              case insensitive.
205
206       -K key Only report data for given key.
207              Multiple -K options can be used to report  more  than  a  single
208              key.
209
210              exiv2 -K Exif.Photo.DateTimeDigitized -K Exif.Photo.DateTimeOriginal -pt R.jpg
211              Exif.Photo.DateTimeOriginal   Ascii      20  2011:09:18 16:25:48
212              Exif.Photo.DateTimeDigitized  Ascii      20  2011:09:18 16:25:48
213
214       -n enc Charset  to  use  to decode Exif Unicode user comments. enc is a
215              name understood by iconv_open(3), e.g., 'UTF-8'.
216
217       -k     Preserve file timestamps when updating files (keep). Can be used
218              with  all  options  which  update  files. The flag is ignored by
219              read-only options.
220
221       -t     Set the file timestamp according to the Exif create timestamp in
222              addition  to  renaming  the  file (overrides -k). This option is
223              only used with the 'rename' action.
224
225       -T     Only set the file timestamp according to the Exif  create  time‐
226              stamp,  do  not  rename  the file (overrides -k). This option is
227              only used with the 'rename' action. Note:  On  Windows  you  may
228              have  to set the TZ environment variable for this option to work
229              correctly.
230
231       -f     Do not prompt before overwriting  existing  files  (force  over‐
232              write).
233
234       -F     Do not prompt before renaming files (Force rename). Appends '_1'
235              ('_2', ...) to the name of the new file.
236
237       -a time
238              Time adjustment in the format [-]HH[:MM[:SS]].  This  option  is
239              only  used  with the 'adjust' action. Examples: 1 adds one hour,
240              1:01 adds one hour and one minute, -0:00:30  subtracts  30  sec‐
241              onds.
242
243       -Y yrs Time  adjustment  by a positive or negative number of years, for
244              the 'adjust' action.
245
246       -O mon Time adjustment by a positive or negative number of months,  for
247              the 'adjust' action.
248
249       -D day Time  adjustment  by  a positive or negative number of days, for
250              the 'adjust' action.
251
252       -p mode
253              Print mode for the 'print' action. Possible modes are:
254              s : print a summary of the Exif metadata (the default)
255              a : print Exif, IPTC and XMP metadata (shortcut for -Pkyct)
256              t : interpreted (translated) Exif tags (-PEkyct)
257              v : plain Exif tag values (-PExgnycv)
258              h : hexdump of the Exif data (-PExgnycsh)
259              i : IPTC datasets (-PIkyct)
260              x : XMP properties (-PXkyct)
261              c : JPEG comment
262              p : list available image previews, sorted by preview image  size
263              in pixels
264              S : print image structure information (jpg, png and tiff only)
265              X : print "raw" XMP (jpg, png and tiff only)
266
267       -P flgs
268              Print  flags  for fine control of the tag list ('print' action).
269              Allows control of the type of metadata as well as  data  columns
270              included in the print output.  Valid flags are:
271              E : include Exif tags in the list
272              I : IPTC datasets
273              X : XMP properties
274              x : print a column with the tag number
275              g : group name
276              k : key
277              l : tag label
278              n : tag name
279              y : type
280              c : number of components (count)
281              s : size in bytes
282              v : plain data value
283              V  :  plain  data value AND the word 'set ' at the start of line
284              (for use with exiv2 -m-)
285              t : interpreted (translated) data
286              h : hexdump of the data
287
288       -d tgt Delete target(s) for the 'delete' action. Possible targets are:
289              a : all supported metadata (the default)
290              e : Exif section
291              t : Exif thumbnail only
292              i : IPTC data
293              x : XMP packet
294              c : JPEG comment
295
296       -i tgt Insert target(s) for the 'insert' action. Possible  targets  are
297              the same as those for the -d option, plus an optional modifier:
298
299              X  :  Insert  metadata  from an XMP sidecar file <file>.xmp. The
300              remaining insert targets determine what metadata to insert  from
301              the  sidecar  file.  Possible  are  Exif,  IPTC  and XMP and the
302              default is all of these. Note that the inserted  XMP  properties
303              include those converted to Exif and IPTC.
304              This  is  option  is intended for "filter" operations on the XMP
305              such as:
306              $ exiv2 -e{tgt}- filename | xmllint .... | exiv2 -i{tgt}-  file‐
307              name
308
309              Only JPEG thumbnails can be inserted (not TIFF thumbnails), they
310              need to be named file-thumb.jpg.
311
312       -e tgt Extract target(s) for the 'extract' action. Possible targets are
313              the  same  as  those for the -d option, plus a target to extract
314              preview images and a modifier to generate an XMP sidecar file:
315              p[<n>[,<m> ...]] : Extract preview images.  The  optional  comma
316              separated  list  of  preview  image numbers is used to determine
317              which preview images to extract. The  available  preview  images
318              and their numbers are displayed with the 'print' option -pp.
319
320              X  :  Extract  metadata  to  an XMP sidecar file <file>.xmp. The
321              remaining extract targets determine what metadata to extract  to
322              the  sidecar  file.  Possible  are  Exif,  IPTC  and XMP and the
323              default is all of these.
324
325              - : Output sidecar file to stdout (see -i tgt for example)
326
327
328       -r fmt Filename format for the 'rename' action. The format string  fol‐
329              lows strftime(3) and supports the following keywords:
330              :basename:   - original filename without extension
331              :dirname:    - name of the directory holding the original file
332              :parentname: - name of parent directory
333              Default filename format is %Y%m%d_%H%M%S.
334
335       -c txt JPEG  comment string to set in the image ('modify' action). This
336              option can also be used with the 'extract' and 'insert'  actions
337              to modify metadata on-the-fly.  -m- represents standard-input.
338
339       -m file
340              Command  file  for  the 'modify' action. This option can also be
341              used with the 'extract' and 'insert' actions to modify  metadata
342              on-the-fly.
343
344       -M cmd Command  line  for  the 'modify' action. This option can also be
345              used with the 'extract' and 'insert' actions to modify  metadata
346              on-the-fly.   The format for the commands is the same as that of
347              the lines of a command file.
348
349       -l dir Location (directory) for files to be inserted or extracted.
350
351       -S .suf
352              Use suffix .suf for source files in 'insert' action.
353

COMMANDS

355       Commands for the 'modify' action can be read from a command file, e.g.,
356
357          exiv2 -m cmd.txt image.jpg
358
359       or given on the command line, as in
360
361          exiv2 -M"add Iptc.Application2.Credit String Mr. Smith" image.jpg
362
363       Note the quotes. Multiple -m and -M options can be combined, and a non-
364       standard XMP namespace registered.
365
366          exiv2 -M"reg myprefix http://ns.myprefix.me/" -M"add Xmp.myprefix.Whom Mr. Smith" -M"set Exif.Image.Artist Mr. Smith" image.jpg
367
368       When writing Exif, IPTC and XMP metadata, exiv2 enforces only a correct
369       metadata structure. It is possible to write tags with types and  values
370       different  from  those specified in the standards, duplicate Exif tags,
371       undefined tags, or incomplete metadata. While exiv2 is able to read all
372       metadata  that  it can write, other programs may have difficulties with
373       images that contain non standard-conforming metadata.
374
375   Command format
376       The format of a command is
377
378       set | add | del key [[type] value]
379
380       set    Set the value of an existing tag with a matching key or add  the
381              tag.
382
383       add    Add a tag (unless key is a non-repeatable IPTC key; nothing pre‐
384              vents you from adding duplicate Exif tags).
385
386       del    Delete all occurrences of a tag (requires only a key).
387
388       key    Exiv2 Exif, IPTC or XMP key.
389
390       type   Byte | Ascii | Short | Long | Rational | Undefined  |  SShort  |
391              SLong | SRational | Comment for Exif keys,
392              String | Date | Time | Short | Undefined for IPTC keys, and
393              XmpText | XmpAlt | XmpBag | XmpSeq | LangAlt for XMP keys.
394
395              A  default type is used if none is explicitly given. The default
396              is determined based on key.
397
398       value  The remaining text on the line is the value. It  can  optionally
399              be   enclosed  in  single  quotes  ('value')  or  double  quotes
400              ("value").
401
402              The value is optional. Not providing any value is equivalent  to
403              an  empty value ("") and is mainly useful to create an XMP array
404              property, e.g., a bag.
405
406              The format of Exif Comment values includes an  optional  charset
407              specification at the beginning:
408              [charset=Ascii|Jis|Unicode|Undefined ]comment
409
410              Undefined  is  used by default if the value doesn't start with a
411              charset definition.
412
413              The format for an IPTC Date value is:
414                  YYYY-MM-DD (year, month, day)
415
416              The format for an IPTC Time value is:
417                  HH:MM:SS (hours, minutes, seconds)
418              and may optionally be followed by:
419                 -HH:MM or +HH:MM (hours, minutes ahead/behind UTC)
420
421              The format of Rational (and SRational) is one of:
422                  integer
423                  integer-numerator/integer-denominator
424                  Fnumber
425                  fnumber
426
427              Rational Examples:
428                  exiv2 "-Mset Exif.Photo.MaxApertureValue 557429/62500" X.jpg
429                  exiv2 "-Mset Exif.Photo.MaxApertureValue F5.6" X.jpg
430
431              The Rational format Fnumber (or fnumber) is for the  convenience
432              of  setting aperture values.  Aperture values are stored in Exif
433              is an APEX value which can be evaluated by the expression:
434
435                  apex-value  =    log(Fnumber) * 2.0 / log(2.0)
436                  Fnumber     = exp(apex-value * log(2.0) / 2.0)
437
438              The Rational format Fnumber is valid for any Rational, even when
439              the  key  is not an Aperture.  More information about APEX value
440              is available from: http://en.wikipedia.org/wiki/APEX_system
441
442              The format of XMP LangAlt values includes an  optional  language
443              qualifier:
444              lang="language-code" text
445
446              lang="x-default"  is used if the value doesn't start with a lan‐
447              guage qualifier.
448
449                  exiv2 -M'set Xmp.dc.title lang="de-DE" Euros' X.jpg
450                  exiv2 -M'set Xmp.dc.title lang="en-GB" Pounds' X.jpg
451                  exiv2 -M'set Xmp.dc.title  lang="en-US"  In  God  We  Trust'
452              X.jpg
453                  exiv2 -M'set Xmp.dc.title All others pay cash' X.jpg
454
455              To  remove  a language specification, set the value to '' (empty
456              string)
457                  exiv2 -M'set Xmp.dc.title lang="en-US"' X.jpg
458
459              To remove all language specifications, delete the key:
460                  exiv2 -M'del Xmp.dc.title' X.jpg
461
462       To register additional XMP namespaces, combine the command with:
463
464       reg prefix namespace
465
466   Command file format
467       Empty lines and lines starting with # in a  command  file  are  ignored
468       (comments). Remaining lines are commands as described above.
469

EXAMPLES

471       exiv2 *.jpg
472              Prints  a  summary of the Exif information for all JPEG files in
473              the directory.
474
475       exiv2 -pi image.jpg
476              Prints the IPTC metadata of the image.
477
478       exiv2 rename img_1234.jpg
479              Renames  img_1234.jpg  (taken  on  13-Nov-05  at  22:58:31)   to
480              20051113_225831.jpg
481
482       exiv2 -r':basename:_%Y%m' rename img_1234.jpg
483              Renames img_1234.jpg to img_1234_200511.jpg
484
485       exiv2 -et img1.jpg img2.jpg
486              Extracts   the   Exif   thumbnails   from  the  two  files  into
487              img1-thumb.jpg and img2-thumb.jpg.
488
489       exiv2 -it img1.jpg img2.jpg
490              Inserts (copies) metadata from img1.exv  to  img1.jpg  and  from
491              img2.exv to img2.jpg.
492
493       exiv2 -ep1,2 image.jpg
494              Extracts previews 1 and 2 from the image to the files image-pre‐
495              view1.jpg and image-preview2.jpg.
496
497       exiv2 -eiX image.jpg
498              Extracts IPTC datasets into an XMP sidecar file image.xmp and in
499              the process converts them to "IPTC Core" XMP schema.
500
501       exiv2 -iixX image.jpg
502              Inserts IPTC and XMP metadata from an XMP sidecar file image.xmp
503              into image.jpg.  The resulting IPTC datasets are converted  from
504              the "IPTC Core" XMP schema properties in the sidecar file to the
505              older IPTC IIM4 format.  The  inserted  XMP  properties  include
506              those in the "IPTC Core" XMP schema.
507
508       exiv2 -M"set Exif.Photo.UserComment charset=Ascii New Exif comment" image.jpg
509              Sets the Exif comment to an ASCII string.
510
511       exiv2 -M"set Exif.GPSInfo.GPSLatitude 4/1 15/1 33/1" \
512              -M"set Exif.GPSInfo.GPSLatitudeRef N" image.jpg
513              Sets the latitude to 4 degrees, 15 minutes and 33 seconds north.
514              The Exif standard stipulates that the GPSLatitude  tag  consists
515              of  three  Rational numbers for the degrees, minutes and seconds
516              of the latitude and GPSLatitudeRef contains either  'N'  or  'S'
517              for north or south latitude respectively.
518
519       exiv2 insert -l/tmp -S.CRW /data/*.JPG
520              Copy  all  metadata  from CRW files in the /tmp directory to JPG
521              files with corresponding basenames in the /data directory.  Note
522              that  this  copies  metadata as is, without any modifications to
523              adapt it to the requirements of the  target  format.  Some  tags
524              copied like this may not make sense in the target image.
525

SEE ALSO

527       http://www.exiv2.org/sample.html#modify
528              Sample command files.
529
530       http://www.exiv2.org/metadata.html
531              Taglists with key and default type values.
532

AUTHORS

534       exiv2  was written by Andreas Huggel and others.  The Exiv2 project web
535       site is http://exiv2.org
536
537       This manual page was originally created for the Debian project by KELE‐
538       MEN Peter <fuji@debian.org>.
539
540
541
542                                 Dec 29, 2015                  EXIV2SAMPLES(1)
Impressum