1EXIV2(1) General Commands Manual EXIV2(1)
2
3
4
6 exiv2 - Image metadata manipulation tool
7
9 exiv2 [options] [action] file ...
10
12 exiv2 is a program to read and write Exif, IPTC, XMP metadata and image
13 comments and can read many vendor makernote tags. The program option‐
14 ally converts between Exif tags, XMP properties and IPTC datasets as
15 recommended by the Exif Standard, the IPTC Standard, the XMP specifica‐
16 tion and Metadata Working Group guidelines.
17 The following image formats are supported:
18
19 Type Exif IPTC XMP Image Comments ICC Profile
20 ──────────────────────────────────────────────────────────────────────────────────
21 JPEG Read/Write Read/Write Read/Write Read/Write Read/Write
22 EXV Read/Write Read/Write Read/Write Read/Write Read/Write
23 CR2 Read/Write Read/Write Read/Write - Read/Write
24 CRW Read/Write - - Read/Write -
25 MRW Read Read Read - -
26 TIFF Read/Write Read/Write Read/Write - Read/Write
27 WEBP Read/Write - Read/Write - Read/Write
28 DNG Read/Write Read/Write Read/Write - Read/Write
29 NEF Read/Write Read/Write Read/Write - Read/Write
30 PEF Read/Write 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 Read/Write
37 PGF Read/Write 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 - 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
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
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
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
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 | e | t | v | h | i | x | c | p | i | C | R | S | X
154 summary, all, exif, translated, vanilla, hex, iptc, xmp, comment, preview,
155 ICC Profile, Recursive Structure, Simple Structure, raw XMP
156
157 tgt a | c | e | i | p | t | x | C | X | XX | -
158 all, comment, exif, iptc, preview, thumb, xmp, ICC Profile, SideCar, RawXMP, stdin/out
159
160
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 e : print Exif metadata (shortcut for -PEkycv)
257 t : interpreted (translated) Exif tags (-PEkyct)
258 v : plain Exif tag values (-PExgnycv)
259 h : hexdump of the Exif data (-PExgnycsh)
260 i : IPTC datasets (-PIkyct)
261 x : XMP properties (-PXkyct)
262 c : JPEG comment
263 p : list available image previews, sorted by preview image size
264 in pixels
265 C : print image ICC Profile (jpg, png, tiff, webp, cr2, jp2
266 only)
267 R : print image structure recursively (jpg, png, tiff, webp,
268 cr2, jp2 only)
269 S : print image structure information (jpg, png, tiff, webp,
270 cr2, jp2 only)
271 X : print "raw" XMP (jpg, png, tiff, webp, cr2, jp2 only)
272
273 -P flgs
274 Print flags for fine control of the tag list ('print' action).
275 Allows control of the type of metadata as well as data columns
276 included in the print output. Valid flags are:
277 E : include Exif tags in the list
278 I : IPTC datasets
279 X : XMP properties
280 x : print a column with the tag number
281 g : group name
282 k : key
283 l : tag label
284 n : tag name
285 y : type
286 c : number of components (count)
287 s : size in bytes
288 v : plain data value (vanilla values)
289 V : plain data value AND the word 'set ' (for use with exiv2
290 -m-)
291 t : interpreted (translated) human readable data
292 h : hexdump of the data
293
294 -d tgt Delete target(s) for the 'delete' action. Possible targets are:
295 a : all supported metadata (the default)
296 e : Exif section
297 t : Exif thumbnail only
298 i : IPTC data
299 x : XMP packet
300 c : JPEG comment
301 C : ICC Profile
302 I : All IPTC data
303
304 -i tgt Insert target(s) for the 'insert' action. Possible targets are
305 the same as those for the -d option, plus an optional modifier:
306
307 X : Insert metadata from an XMP sidecar file <file>.xmp. The
308 remaining insert targets determine what metadata to insert from
309 the sidecar file. Possible are Exif, IPTC and XMP and the
310 default is all of these. Note that the inserted XMP properties
311 include those converted to Exif and IPTC.
312
313 XX: Insert "raw" XMP metadata from a sidecar (see option -pX)
314
315 - : Read from stdin. This option is intended for "filter" oper‐
316 ations such as:
317 $ exiv2 -e{tgt}- filename | xmllint .... | exiv2 -i{tgt}- file‐
318 name
319
320 Only JPEG thumbnails can be inserted (not TIFF thumbnails), and
321 must be named file-thumb.jpg.
322
323 -e tgt Extract target(s) for the 'extract' action. Possible targets are
324 the same as those for the -d option, plus a target to extract
325 preview images and a modifier to generate an XMP sidecar file:
326 p[<n>[,<m> ...]] : Extract preview images. The optional comma
327 separated list of preview image numbers is used to determine
328 which preview images to extract. The available preview images
329 and their numbers are displayed with the 'print' option -pp.
330
331 C : Extract embedded ICC profile to <file>.icc
332
333 X : Extract metadata to an XMP sidecar file <file>.xmp. The
334 remaining extract targets determine what metadata to extract to
335 the sidecar file. Possible are Exif, IPTC and XMP and the
336 default is all of these.
337
338 XX: Extract "raw" XMP metadata to a sidecar (see -pX)
339 You may not use modify commands with the -eXX option and
340 only XMP is written to the sidecar.
341
342 - : Output to stdout (see -i tgt for an example of this feature)
343
344
345 -r fmt Filename format for the 'rename' action. The format string fol‐
346 lows strftime(3) and supports the following keywords:
347
348 :basename: original filename without extension
349 :dirname: name of the directory holding the original file
350 :parentname: name of parent directory
351 Default filename format is %Y%m%d_%H%M%S.
352
353 -c txt JPEG comment string to set in the image ('modify' action). This
354 option can also be used with the 'extract' and 'insert' actions
355 to modify metadata on-the-fly.
356
357 -m file
358 Command file for the 'modify' action. This option can also be
359 used with the 'extract' and 'insert' actions to modify metadata
360 on-the-fly. -m- represents standard-input.
361
362 -M cmd Command line for the 'modify' action. This option can also be
363 used with the 'extract' and 'insert' actions to modify metadata
364 on-the-fly. The format for the commands is the same as that of
365 the lines of a command file.
366
367 -l dir Location (directory) for files to be inserted or extracted.
368
369 -S .suf
370 Use suffix .suf for source files in 'insert' action.
371
373 Commands for the 'modify' action can be read from a command file, e.g.,
374
375 exiv2 -m cmd.txt image.jpg
376
377 or given on the command line, as in
378
379 exiv2 -M"add Iptc.Application2.Credit String Mr. Smith" image.jpg
380
381 Note the quotes. Multiple -m and -M options can be combined, and a non-
382 standard XMP namespace registered.
383
384 exiv2 -M"reg myprefix http://ns.myprefix.me/" -M"add Xmp.myprefix.Whom Mr. Smith" -M"set Exif.Image.Artist Mr. Smith" image.jpg
385
386 When writing Exif, IPTC and XMP metadata, exiv2 enforces only a correct
387 metadata structure. It is possible to write tags with types and values
388 different from those specified in the standards, duplicate Exif tags,
389 undefined tags, or incomplete metadata. While exiv2 is able to read all
390 metadata that it can write, other programs may have difficulties with
391 images that contain non standard-conforming metadata.
392
393 Command format
394 The format of a command is
395
396 set | add | del key [[type] value]
397
398 set Set the value of an existing tag with a matching key or add the
399 tag.
400
401 add Add a tag (unless key is a non-repeatable IPTC key; nothing pre‐
402 vents you from adding duplicate Exif tags).
403
404 del Delete all occurrences of a tag (requires only a key).
405
406 key Exiv2 Exif, IPTC or XMP key.
407
408 type Byte | Ascii | Short | Long | Rational | Undefined | SShort |
409 SLong | SRational | Comment for Exif keys,
410 String | Date | Time | Short | Undefined for IPTC keys, and
411 XmpText | XmpAlt | XmpBag | XmpSeq | LangAlt for XMP keys.
412
413 A default type is used if none is explicitly given. The default
414 is determined based on key.
415
416 value The remaining text on the line is the value. It can optionally
417 be enclosed in single quotes ('value') or double quotes
418 ("value").
419
420 The value is optional. Not providing any value is equivalent to
421 an empty value ("") and is mainly useful to create an XMP array
422 property, e.g., a bag.
423
424 The format of Exif Comment values includes an optional charset
425 specification at the beginning:
426 [charset=Ascii|Jis|Unicode|Undefined ]comment
427
428 Undefined is used by default if the value doesn't start with a
429 charset definition.
430
431 The format for an IPTC Date value is:
432
433 YYYY-MM-DD (year, month, day)
434
435 The format for an IPTC Time value is:
436
437 HH:MM:SS (hours, minutes, seconds)
438
439 and may optionally be followed by:
440
441 -HH:MM or +HH:MM (hours, minutes ahead/behind UTC)
442
443 The format of Rational (and SRational) is one of:
444
445 integer | integer/integer | Fnumber | number
446
447 Rational Examples:
448
449 $ exiv2 "-Mset Exif.Photo.MaxApertureValue 557429/62500" X.jpg
450 $ exiv2 "-Mset Exif.Photo.MaxApertureValue F5.6" X.jpg
451
452 The Rational format Fnumber is for the convenience of setting
453 aperture values. Aperture values are stored in Exif is an APEX
454 value which can be evaluated by the expression:
455
456 apex-value = log(Fnumber) * 2.0 / log(2.0)
457 number = exp(apex-value * log(2.0) / 2.0)
458
459 The Rational format Fnumber is valid for any Rational, even when
460 the key is not an Aperture. More information about APEX value
461 is available from: http://en.wikipedia.org/wiki/APEX_system
462
463 The format of XMP LangAlt values includes an optional language
464 qualifier:
465 lang="language-code" text
466
467 lang="x-default" is used if the value doesn't start with a lan‐
468 guage qualifier.
469
470 $ exiv2 -M'set Xmp.dc.title lang="de-DE" Euros' X.jpg
471 $ exiv2 -M'set Xmp.dc.title lang="en-GB" Pounds' X.jpg
472 $ exiv2 -M'set Xmp.dc.title lang="en-US" In God We Trust' X.jpg
473 $ exiv2 -M'set Xmp.dc.title All others pay cash' X.jpg
474
475 To remove a language specification, set the value to '' (empty
476 string)
477 exiv2 -M'set Xmp.dc.title lang="en-US"' X.jpg
478 To remove all language specifications, delete the key:
479 $ exiv2 -M'del Xmp.dc.title' X.jpg
480 To register additional XMP namespaces, combine the command with:
481 reg prefix namespace
482
483 Command file format
484 Empty lines and lines starting with # in a command file are ignored
485 (comments). Remaining lines are commands as described above.
486
488 exiv2 *.jpg
489 Prints a summary of the Exif information for all JPEG files in
490 the directory.
491
492 exiv2 -pi image.jpg
493 Prints the IPTC metadata of the image.
494
495 exiv2 rename img_1234.jpg
496 Renames img_1234.jpg (taken on 13-Nov-05 at 22:58:31) to
497 20051113_225831.jpg
498
499 exiv2 -r':basename:_%Y%m' rename img_1234.jpg
500 Renames img_1234.jpg to img_1234_200511.jpg
501
502 exiv2 -et img1.jpg img2.jpg
503 Extracts the Exif thumbnails from the two files into
504 img1-thumb.jpg and img2-thumb.jpg.
505
506 exiv2 -it img1.jpg img2.jpg
507 Inserts (copies) metadata from img1.exv to img1.jpg and from
508 img2.exv to img2.jpg.
509
510 exiv2 -ep1,2 image.jpg
511 Extracts previews 1 and 2 from the image to the files image-pre‐
512 view1.jpg and image-preview2.jpg.
513
514 exiv2 -eiX image.jpg
515 Extracts IPTC datasets into an XMP sidecar file image.xmp and in
516 the process converts them to "IPTC Core" XMP schema.
517
518 exiv2 -iixX image.jpg
519 Inserts IPTC and XMP metadata from an XMP sidecar file image.xmp
520 into image.jpg. The resulting IPTC datasets are converted from
521 the "IPTC Core" XMP schema properties in the sidecar file to the
522 older IPTC IIM4 format. The inserted XMP properties include
523 those in the "IPTC Core" XMP schema.
524
525 exiv2 -M"set Exif.Photo.UserComment charset=Ascii New Exif comment"
526 image.jpg
527 Sets the Exif comment to an ASCII string.
528
529 exiv2 -M"set Exif.GPSInfo.GPSLatitude 4/1 15/1 33/1" \ -M"set
530 Exif.GPSInfo.GPSLatitudeRef N" image.jpg
531 Sets the latitude to 4 degrees, 15 minutes and 33 seconds north.
532 The Exif standard stipulates that the GPSLatitude tag consists
533 of three Rational numbers for the degrees, minutes and seconds
534 of the latitude and GPSLatitudeRef contains either 'N' or 'S'
535 for north or south latitude respectively.
536
537 exiv2 insert -l/tmp -S.CRW /data/*.JPG
538 Copy all metadata from CRW files in the /tmp directory to JPG
539 files with corresponding basenames in the /data directory. Note
540 that this copies metadata as is, without any modifications to
541 adapt it to the requirements of the target format. Some tags
542 copied like this may not make sense in the target image.
543
545 http://www.exiv2.org/sample.html#modify
546 Sample command files.
547
548 http://www.exiv2.org/metadata.html
549 Taglists with key and default type values.
550
552 exiv2 was written by Andreas Huggel and others. The Exiv2 project web
553 site is http://exiv2.org
554
555 This manual page was originally created for the Debian project by KELE‐
556 MEN Peter <fuji@debian.org>.
557
558
559
560 Oct 19, 2016 EXIV2(1)