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 Example: exiv2 -v -V -g webready -g time.
189
190 exiv2 -g Date -pt R.jpg
191 Exif.Image.DateTime Ascii 20 2012:08:07 16:01:05
192 Exif.Photo.DateTimeOriginal Ascii 20 2011:09:18 16:25:48
193 Exif.Photo.DateTimeDigitized Ascii 20 2011:09:18 16:25:48
194
195 -g (--grep) is only applied to keys. It is not generally
196 applied to all output such as the default -ps report.
197
198 The key may finish with the optional modifier /i to indicated
199 case insensitive.
200
201 -K key Only report data for given key.
202 Multiple -K options can be used to report more than a single
203 key.
204
205 exiv2 -K Exif.Photo.DateTimeDigitized -K Exif.Photo.DateTimeOriginal -pt R.jpg
206 Exif.Photo.DateTimeOriginal Ascii 20 2011:09:18 16:25:48
207 Exif.Photo.DateTimeDigitized Ascii 20 2011:09:18 16:25:48
208
209 -n enc Charset to use to decode Exif Unicode user comments. enc is a
210 name understood by iconv_open(3), e.g., 'UTF-8'.
211
212 -k Preserve file timestamps when updating files (keep). Can be used
213 with all options which update files. The flag is ignored by
214 read-only options.
215
216 -t Set the file timestamp according to the Exif create timestamp in
217 addition to renaming the file (overrides -k). This option is
218 only used with the 'rename' action.
219
220 -T Only set the file timestamp according to the Exif create time‐
221 stamp, do not rename the file (overrides -k). This option is
222 only used with the 'rename' action. Note: On Windows you may
223 have to set the TZ environment variable for this option to work
224 correctly.
225
226 -f Do not prompt before overwriting existing files (force over‐
227 write).
228
229 -F Do not prompt before renaming files (Force rename). Appends '_1'
230 ('_2', ...) to the name of the new file.
231
232 -a time
233 Time adjustment in the format [-]HH[:MM[:SS]]. This option is
234 only used with the 'adjust' action. Examples: 1 adds one hour,
235 1:01 adds one hour and one minute, -0:00:30 subtracts 30 sec‐
236 onds.
237
238 -Y yrs Time adjustment by a positive or negative number of years, for
239 the 'adjust' action.
240
241 -O mon Time adjustment by a positive or negative number of months, for
242 the 'adjust' action.
243
244 -D day Time adjustment by a positive or negative number of days, for
245 the 'adjust' action.
246
247 -p mode
248 Print mode for the 'print' action. Possible modes are:
249
250 s : print a summary of the Exif metadata (the default)
251 a : print Exif, IPTC and XMP metadata (shortcut for -Pkyct)
252 e : print Exif metadata (shortcut for -PEkycv)
253 t : interpreted (translated) Exif tags (-PEkyct)
254 v : plain Exif tag values (-PExgnycv)
255 h : hexdump of the Exif data (-PExgnycsh)
256 i : IPTC datasets (-PIkyct)
257 x : XMP properties (-PXkyct)
258 c : JPEG comment
259 p : list available image previews, sorted by preview image size in pixels
260 C : print image ICC Profile (jpg, png, tiff, webp, cr2, jp2 only)
261 R : print image structure recursively (jpg, png, tiff, webp, cr2, jp2 only)
262 S : print image structure information (jpg, png, tiff, webp, cr2, jp2 only)
263 X : print "raw" XMP (jpg, png, tiff, webp, cr2, jp2 only)
264
265 -P flgs
266 Print flags for fine control of the tag list ('print' action).
267 Allows control of the type of metadata as well as data columns
268 included in the print output. Valid flags are:
269
270 E : include Exif tags in the list
271 I : IPTC datasets
272 X : XMP properties
273 x : print a column with the tag number
274 g : group name
275 k : key
276 l : tag label
277 n : tag name
278 y : type
279 c : number of components (count)
280 s : size in bytes
281 v : plain data value (vanilla values)
282 V : plain data value AND the word 'set ' (for use with exiv2 -m-)
283 t : interpreted (translated) human readable data
284 h : hexdump of the data
285
286 -d tgt Delete target(s) for the 'delete' action. Possible targets are:
287
288 a : all supported metadata (the default)
289 e : Exif section
290 t : Exif thumbnail only
291 i : IPTC data
292 x : XMP packet
293 c : JPEG comment
294 C : ICC Profile
295 I : All IPTC data
296
297 -i tgt Insert target(s) for the 'insert' action. Possible targets are
298 the same as those for the -d option, plus an optional modifier:
299
300 X : Insert metadata from an XMP sidecar file <file>.xmp. The
301 remaining insert targets determine what metadata to insert from
302 the sidecar file. Possible are Exif, IPTC and XMP and the
303 default is all of these. Note that the inserted XMP properties
304 include those converted to Exif and IPTC.
305
306 XX: Insert "raw" XMP metadata from a sidecar (see option -pX)
307
308 - : Read from stdin. This option is intended for "filter" oper‐
309 ations such as:
310 $ exiv2 -e{tgt}- filename | xmllint .... | exiv2 -i{tgt}- file‐
311 name
312
313 Only JPEG thumbnails can be inserted (not TIFF thumbnails), and
314 must be named file-thumb.jpg.
315
316 -e tgt Extract target(s) for the 'extract' action. Possible targets are
317 the same as those for the -d option, plus a target to extract
318 preview images and a modifier to generate an XMP sidecar file:
319 p[<n>[,<m> ...]] : Extract preview images. The optional comma
320 separated list of preview image numbers is used to determine
321 which preview images to extract. The available preview images
322 and their numbers are displayed with the 'print' option -pp.
323
324 C : Extract embedded ICC profile to <file>.icc
325
326 X : Extract metadata to an XMP sidecar file <file>.xmp. The
327 remaining extract targets determine what metadata to extract to
328 the sidecar file. Possible are Exif, IPTC and XMP and the
329 default is all of these.
330
331 XX: Extract "raw" XMP metadata to a sidecar (see -pX)
332 You may not use modify commands with the -eXX option and
333 only XMP is written to the sidecar.
334
335 - : Output to stdout (see -i tgt for an example of this feature)
336
337
338 -r fmt Filename format for the 'rename' action. The format string fol‐
339 lows strftime(3) and supports the following keywords:
340
341 :basename: original filename without extension
342 :dirname: name of the directory holding the original file
343 :parentname: name of parent directory
344 Default filename format is %Y%m%d_%H%M%S.
345
346 -c txt JPEG comment string to set in the image ('modify' action). This
347 option can also be used with the 'extract' and 'insert' actions
348 to modify metadata on-the-fly.
349
350 -m file
351 Command file for the 'modify' action. This option can also be
352 used with the 'extract' and 'insert' actions to modify metadata
353 on-the-fly. -m- represents standard-input.
354
355 -M cmd Command line for the 'modify' action. This option can also be
356 used with the 'extract' and 'insert' actions to modify metadata
357 on-the-fly. The format for the commands is the same as that of
358 the lines of a command file.
359
360 -l dir Location (directory) for files to be inserted or extracted.
361
362 -S .suf
363 Use suffix .suf for source files in 'insert' action.
364
366 Commands for the 'modify' action can be read from a command file, e.g.,
367
368 exiv2 -m cmd.txt image.jpg
369
370 or given on the command line, as in
371
372 exiv2 -M"add Iptc.Application2.Credit String Mr. Smith" image.jpg
373
374 Note the quotes. Multiple -m and -M options can be combined, and a non-
375 standard XMP namespace registered.
376
377 exiv2 -M"reg myprefix http://ns.myprefix.me/" -M"add Xmp.myprefix.Whom Mr. Smith" -M"set Exif.Image.Artist Mr. Smith" image.jpg
378
379 When writing Exif, IPTC and XMP metadata, exiv2 enforces only a correct
380 metadata structure. It is possible to write tags with types and values
381 different from those specified in the standards, duplicate Exif tags,
382 undefined tags, or incomplete metadata. While exiv2 is able to read all
383 metadata that it can write, other programs may have difficulties with
384 images that contain non standard-conforming metadata.
385
386 Command format
387 The format of a command is
388
389 set | add | del key [[type] value]
390
391 set Set the value of an existing tag with a matching key or add the
392 tag.
393
394 add Add a tag (unless key is a non-repeatable IPTC key; nothing pre‐
395 vents you from adding duplicate Exif tags).
396
397 del Delete all occurrences of a tag (requires only a key).
398
399 key Exiv2 Exif, IPTC or XMP key.
400
401 type Byte | Ascii | Short | Long | Rational | Undefined | SShort |
402 SLong | SRational | Comment for Exif keys,
403 String | Date | Time | Short | Undefined for IPTC keys, and
404 XmpText | XmpAlt | XmpBag | XmpSeq | LangAlt for XMP keys.
405
406 A default type is used if none is explicitly given. The default
407 is determined based on key.
408
409 value The remaining text on the line is the value. It can optionally
410 be enclosed in single quotes ('value') or double quotes
411 ("value").
412
413 The value is optional. Not providing any value is equivalent to
414 an empty value ("") and is mainly useful to create an XMP array
415 property, e.g., a bag.
416
417 The format of Exif Comment values includes an optional charset
418 specification at the beginning:
419 [charset=Ascii|Jis|Unicode|Undefined ]comment
420
421 Undefined is used by default if the value doesn't start with a
422 charset definition.
423
424 The format for an IPTC Date value is:
425
426 YYYY-MM-DD (year, month, day)
427
428 The format for an IPTC Time value is:
429
430 HH:MM:SS (hours, minutes, seconds)
431
432 and may optionally be followed by:
433
434 -HH:MM or +HH:MM (hours, minutes ahead/behind UTC)
435
436 The format of Rational (and SRational) is one of:
437
438 integer | integer/integer | Fnumber | number
439
440 Rational Examples:
441
442 $ exiv2 "-Mset Exif.Photo.MaxApertureValue 557429/62500" X.jpg
443 $ exiv2 "-Mset Exif.Photo.MaxApertureValue F5.6" X.jpg
444
445 The Rational format Fnumber is for the convenience of setting
446 aperture values. Aperture values are stored in Exif is an APEX
447 value which can be evaluated by the expression:
448
449 apex-value = log(Fnumber) * 2.0 / log(2.0)
450 number = exp(apex-value * log(2.0) / 2.0)
451
452 The Rational format Fnumber is valid for any Rational, even when
453 the key is not an Aperture. More information about APEX value
454 is available from: http://en.wikipedia.org/wiki/APEX_system
455
456 The format of XMP LangAlt values includes an optional language
457 qualifier:
458 lang="language-code" text
459
460 lang="x-default" is used if the value doesn't start with a lan‐
461 guage qualifier.
462
463 $ exiv2 -M'set Xmp.dc.title lang="de-DE" Euros' X.jpg
464 $ exiv2 -M'set Xmp.dc.title lang="en-GB" Pounds' X.jpg
465 $ exiv2 -M'set Xmp.dc.title lang="en-US" In God We Trust' X.jpg
466 $ exiv2 -M'set Xmp.dc.title All others pay cash' X.jpg
467
468 To remove a language specification, set the value to '' (empty
469 string)
470 exiv2 -M'set Xmp.dc.title lang="en-US"' X.jpg
471 To remove all language specifications, delete the key:
472 $ exiv2 -M'del Xmp.dc.title' X.jpg
473 To register additional XMP namespaces, combine the command with:
474 reg prefix namespace
475
476 Command file format
477 Empty lines and lines starting with # in a command file are ignored
478 (comments). Remaining lines are commands as described above.
479
481 Exiv2 can read an optional configuration file ~/.exiv2 on Unix systems
482 and %USERPROFILE%\exiv2.ini on Windows (using a Visual Studio build).
483 Cygwin and MinGW/msys2 follow the unix convention and use ~/.exiv2 You
484 can fine the location of the configuration file with the command:
485
486 $ exiv2 --verbose --version --grep config_path
487 exiv2 0.27.0.1
488 config_path=/Users/rmills/.exiv2
489
490 The purpose of the configuration file is to define your own lenses for
491 recognition by Exiv2. The configuration file is in Windows .ini format
492 and has sections for each of the major camera manufactures
493 canon,nikon,pentax,minolta,olympus and sony. The lens metadata is
494 stored as a integer called the lensID. You can change the lens name
495 associated with any lensID.
496
497 $ cat ~/.exiv2
498 [nikon]
499 146=Robin's Sigma Lens <--- The name of your lens
500
501 You obtain the lensID for your camera with the command:
502
503 $ exiv2 -pv --grep lens/i http://clanmills.com/Stonehenge.jpg
504 0x0083 Nikon3 LensType Byte 1 14
505 0x0084 Nikon3 Lens Rational 4 180/10 2500/10 35/10 63/10
506 0x008b Nikon3 LensFStops Undefined 4 55 1 12 0
507 0x000c NikonLd3 LensIDNumber Byte 1 146 <--- This number
508 0x000d NikonLd3 LensFStops Byte 1 55
509
511 exiv2 *.jpg
512 Prints a summary of the Exif information for all JPEG files in
513 the directory.
514
515 exiv2 -pi image.jpg
516 Prints the IPTC metadata of the image.
517
518 exiv2 rename img_1234.jpg
519 Renames img_1234.jpg (taken on 13-Nov-05 at 22:58:31) to
520 20051113_225831.jpg
521
522 exiv2 -r':basename:_%Y%m' rename img_1234.jpg
523 Renames img_1234.jpg to img_1234_200511.jpg
524
525 exiv2 -et img1.jpg img2.jpg
526 Extracts the Exif thumbnails from the two files into
527 img1-thumb.jpg and img2-thumb.jpg.
528
529 exiv2 -it img1.jpg img2.jpg
530 Inserts (copies) metadata from img1.exv to img1.jpg and from
531 img2.exv to img2.jpg.
532
533 exiv2 -ep1,2 image.jpg
534 Extracts previews 1 and 2 from the image to the files image-pre‐
535 view1.jpg and image-preview2.jpg.
536
537 exiv2 -eiX image.jpg
538 Extracts IPTC datasets into an XMP sidecar file image.xmp and in
539 the process converts them to "IPTC Core" XMP schema.
540
541 exiv2 -iixX image.jpg
542 Inserts IPTC and XMP metadata from an XMP sidecar file image.xmp
543 into image.jpg. The resulting IPTC datasets are converted from
544 the "IPTC Core" XMP schema properties in the sidecar file to the
545 older IPTC IIM4 format. The inserted XMP properties include
546 those in the "IPTC Core" XMP schema.
547
548 exiv2 -M"set Exif.Photo.UserComment charset=Ascii New Exif comment"
549 image.jpg
550 Sets the Exif comment to an ASCII string.
551
552 exiv2 -M"set Exif.GPSInfo.GPSLatitude 4/1 15/1 33/1" \ -M"set
553 Exif.GPSInfo.GPSLatitudeRef N" image.jpg
554 Sets the latitude to 4 degrees, 15 minutes and 33 seconds north.
555 The Exif standard stipulates that the GPSLatitude tag consists
556 of three Rational numbers for the degrees, minutes and seconds
557 of the latitude and GPSLatitudeRef contains either 'N' or 'S'
558 for north or south latitude respectively.
559
560 exiv2 insert -l/tmp -S.CRW /data/*.JPG
561 Copy all metadata from CRW files in the /tmp directory to JPG
562 files with corresponding basenames in the /data directory. Note
563 that this copies metadata as is, without any modifications to
564 adapt it to the requirements of the target format. Some tags
565 copied like this may not make sense in the target image.
566
568 https://exiv2.org/sample.html#modify
569 Sample command files.
570
571 https://exiv2.org/metadata.html
572 Taglists with key and default type values.
573
575 exiv2 was written by Andreas Huggel and others. The Exiv2 project web
576 site is https://exiv2.org. The code is hosted on GitHub at
577 https://github.com/exiv2/exiv2
578
579 This manual page was originally created for the Debian project by KELE‐
580 MEN Peter <fuji@debian.org>.
581
582
583
584 Apr 25, 2019 EXIV2(1)