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 and XMP image metadata
13 and image comments. The following image formats are supported:
14
15 Type Exif IPTC XMP Image comments
16 ─────────────────────────────────────────────────────────────
17 JPEG Read/Write Read/Write Read/Write Read/Write
18 EXV Read/Write Read/Write Read/Write Read/Write
19 CR2 Read Read Read -
20 CRW Read/Write - - Read/Write
21 MRW Read Read Read -
22 TIFF Read/Write Read/Write Read/Write -
23 DNG Read/Write Read/Write Read/Write -
24 NEF Read/Write Read/Write Read/Write -
25 PEF Read/Write Read/Write Read/Write -
26 ARW Read Read Read -
27 RW2 Read Read Read -
28 SR2 Read Read Read -
29 SRW Read/Write Read/Write Read/Write -
30 ORF Read/Write Read/Write Read/Write -
31 PNG Read/Write Read/Write Read/Write Read/Write
32 PGF Read/Write Read/Write Read/Write Read/Write
33 RAF Read Read Read -
34 XMP - - Read/Write -
35 GIF - - - -
36 PSD Read/Write Read/Write Read/Write -
37 TGA - - - -
38 BMP - - - -
39 JP2 Read/Write Read/Write Read/Write -
40
41 · Support for GIF, TGA and BMP images is minimal: the image format is
42 recognized, a MIME type assigned to it and the height and width of
43 the image are determined.
44
45 · Reading other TIFF-like RAW image formats, which are not listed in
46 the table, may also work.
47
49 The action argument is only required if it is not clear from the
50 options which action is implied.
51
52 pr | print
53 Print image metadata. This is the default action, i.e., the com‐
54 mand exiv2 image.jpg will print a summary of the image Exif
55 metadata.
56
57 ex | extract
58 Extract metadata to *.exv, XMP sidecar (*.xmp) and thumbnail
59 image files. Modification commands can be applied on-the-fly.
60
61 in | insert
62 Insert metadata from corresponding *.exv, XMP sidecar (*.xmp)
63 and thumbnail files. Use option -S .suf to change the suffix of
64 the input files. Since files of any supported format can be used
65 as input files, this command can be used to copy the metadata
66 between files of different formats. Modification commands can be
67 applied on-the-fly.
68
69 rm | delete
70 Delete image metadata from the files.
71
72 ad | adjust
73 Adjust Exif timestamps by the given time. Requires at least one
74 of the options -a time, -Y yrs, -O mon or -D day.
75
76 mo | modify
77 Apply commands to modify (add, set, delete) the Exif, IPTC and
78 XMP metadata of image files. Requires option -c, -m or -M.
79
80 mv | rename
81 Rename files and/or set file timestamps according to the Exif
82 create timestamp. Uses the value of tag Exif.Photo.DateTimeOrig‐
83 inal or, if not present, Exif.Image.DateTime to determine the
84 timestamp. The filename format can be set with -r fmt, timestamp
85 options are -t and -T.
86
87 fi | fixiso
88 Copy the ISO setting from one of the proprietary Nikon or Canon
89 makernote ISO tags to the regular Exif ISO tag,
90 Exif.Photo.ISOSpeedRatings. Does not overwrite an existing stan‐
91 dard Exif ISO tag.
92
93 fc | fixcom
94 Fix the character encoding of Exif Unicode user comments.
95 Decodes the comment using the auto-detected or specified charac‐
96 ter encoding and writes it back in UCS-2. Use option -n to spec‐
97 ify the current encoding of the comment if necessary.
98
100 -h Display help and exit.
101
102 -V Show the program version and exit.
103
104 -v Be verbose during the program run.
105
106 -q Silence warnings and error messages from the Exiv2 library dur‐
107 ing the program run (quiet). Note that options -v and -q can be
108 used at the same time.
109
110 -b Show large binary values (default is to suppress them).
111
112 -u Show unknown tags (default is to suppress tags which don't have
113 a name).
114
115 -g key Only output info for this Exiv2 key (grep). Multiple -g options
116 can be used to grep info for several keys.
117
118 -n enc Charset to use to decode Exif Unicode user comments. enc is a
119 name understood by iconv_open(3), e.g., 'UTF-8'.
120
121 -k Preserve file timestamps when updating files (keep). Can be used
122 with all options which update files. The flag is ignored by
123 read-only options.
124
125 -t Set the file timestamp according to the Exif create timestamp in
126 addition to renaming the file (overrides -k). This option is
127 only used with the 'rename' action.
128
129 -T Only set the file timestamp according to the Exif create time‐
130 stamp, do not rename the file (overrides -k). This option is
131 only used with the 'rename' action. Note: On Windows you may
132 have to set the TZ environment variable for this option to work
133 correctly.
134
135 -f Do not prompt before overwriting existing files (force over‐
136 write).
137
138 -F Do not prompt before renaming files (Force rename). Appends '_1'
139 ('_2', ...) to the name of the new file.
140
141 -a time
142 Time adjustment in the format [-]HH[:MM[:SS]]. This option is
143 only used with the 'adjust' action. Examples: 1 adds one hour,
144 1:01 adds one hour and one minute, -0:00:30 subtracts 30 sec‐
145 onds.
146
147 -Y yrs Time adjustment by a positive or negative number of years, for
148 the 'adjust' action.
149
150 -O mon Time adjustment by a positive or negative number of months, for
151 the 'adjust' action.
152
153 -D day Time adjustment by a positive or negative number of days, for
154 the 'adjust' action.
155
156 -p mode
157 Print mode for the 'print' action. Possible modes are:
158 s : print a summary of the Exif metadata (the default)
159 a : print Exif, IPTC and XMP metadata (shortcut for -Pkyct)
160 t : interpreted (translated) Exif tags (-PEkyct)
161 v : plain Exif tag values (-PExgnycv)
162 h : hexdump of the Exif data (-PExgnycsh)
163 i : IPTC datasets (-PIkyct)
164 x : XMP properties (-PXkyct)
165 c : JPEG comment
166 p : list available image previews, sorted by preview image size
167 in pixels
168
169 -P flgs
170 Print flags for fine control of the tag list ('print' action).
171 Allows control of the type of metadata as well as data columns
172 included in the print output. Valid flags are:
173 E : include Exif tags in the list
174 I : IPTC datasets
175 X : XMP properties
176 x : print a column with the tag number
177 g : group name
178 k : key
179 l : tag label
180 n : tag name
181 y : type
182 c : number of components (count)
183 s : size in bytes
184 v : plain data value
185 t : interpreted (translated) data
186 h : hexdump of the data
187
188 -d tgt Delete target(s) for the 'delete' action. Possible targets are:
189 a : all supported metadata (the default)
190 e : Exif section
191 t : Exif thumbnail only
192 i : IPTC data
193 x : XMP packet
194 c : JPEG comment
195
196 -i tgt Insert target(s) for the 'insert' action. Possible targets are
197 the same as those for the -d option, plus a modifier:
198 X : Insert metadata from an XMP sidecar file <file>.xmp. The
199 remaining insert targets determine what metadata to insert from
200 the sidecar file. Possible are Exif, IPTC and XMP and the
201 default is all of these. Note that the inserted XMP properties
202 include those converted to Exif and IPTC.
203 Only JPEG thumbnails can be inserted (not TIFF thumbnails), they
204 need to be named file-thumb.jpg.
205
206 -e tgt Extract target(s) for the 'extract' action. Possible targets are
207 the same as those for the -d option, plus a target to extract
208 preview images and a modifier to generate an XMP sidecar file:
209 p[<n>[,<m> ...]] : Extract preview images. The optional comma
210 separated list of preview image numbers is used to determine
211 which preview images to extract. The available preview images
212 and their numbers are displayed with the 'print' option -pp.
213 X : Extract metadata to an XMP sidecar file <file>.xmp. The
214 remaining extract targets determine what metadata to extract to
215 the sidecar file. Possible are Exif, IPTC and XMP and the
216 default is all of these.
217
218 -r fmt Filename format for the 'rename' action. The format string fol‐
219 lows strftime(3) and supports the following keywords:
220 :basename: - original filename without extension
221 :dirname: - name of the directory holding the original file
222 :parentname: - name of parent directory
223 Default filename format is %Y%m%d_%H%M%S.
224
225 -c txt JPEG comment string to set in the image ('modify' action). This
226 option can also be used with the 'extract' and 'insert' actions
227 to modify metadata on-the-fly.
228
229 -m file
230 Command file for the 'modify' action. This option can also be
231 used with the 'extract' and 'insert' actions to modify metadata
232 on-the-fly.
233
234 -M cmd Command line for the 'modify' action. This option can also be
235 used with the 'extract' and 'insert' actions to modify metadata
236 on-the-fly. The format for the commands is the same as that of
237 the lines of a command file.
238
239 -l dir Location (directory) for files to be inserted or extracted.
240
241 -S .suf
242 Use suffix .suf for source files in 'insert' action.
243
245 Commands for the 'modify' action can be read from a command file, e.g.,
246
247 exiv2 -m cmd.txt image.jpg
248
249 or given on the command line, as in
250
251 exiv2 -M"add Iptc.Application2.Credit String Mr. Smith" image.jpg
252
253 Note the quotes. Multiple -m and -M options can be combined.
254
255 When writing Exif, IPTC and XMP metadata, exiv2 enforces only a correct
256 metadata structure. It is possible to write tags with types and values
257 different from those specified in the standards, duplicate Exif tags,
258 undefined tags, or incomplete metadata. While exiv2 is able to read all
259 metadata that it can write, other programs may have difficulties with
260 images that contain non standard-conforming metadata.
261
262 Command format
263 The format of a command is
264
265 set | add | del key [[type] value]
266
267 set Set the value of an existing tag with a matching key or add the
268 tag.
269
270 add Add a tag (unless key is a non-repeatable IPTC key; nothing pre‐
271 vents you from adding duplicate Exif tags).
272
273 del Delete all occurrences of a tag (requires only a key).
274
275 key Exiv2 Exif, IPTC or XMP key.
276
277 type Byte | Ascii | Short | Long | Rational | Undefined | SShort |
278 SLong | SRational | Comment for Exif keys,
279 String | Date | Time | Short | Undefined for IPTC keys, and
280 XmpText | XmpAlt | XmpBag | XmpSeq | LangAlt for XMP keys.
281
282 A default type is used if none is explicitely given. The default
283 is determined based on key.
284
285 value The remaining text on the line is the value. It can optionally
286 be enclosed in single quotes ('value') or double quotes
287 ("value").
288
289 The format of Exif Comment values includes an optional charset
290 specification at the beginning:
291
292 [charset=Ascii|Jis|Unicode|Undefined ]comment
293
294 Undefined is used by default if the value doesn't start with a
295 charset definition.
296
297 The format for IPTC Date values is YYYY-MM-DD (year, month,
298 day), that for IPTC Time values is HH:MM:SS+|-HH:MM, where
299 HH:MM:SS refers to local hour, minute and seconds and +|-HH:MM
300 refers to hours and minutes ahead or behind Universal Coordi‐
301 nated Time (+|- means either a + or a - sign is required).
302
303 The format of XMP LangAlt values includes an optional language
304 qualifier:
305
306 [lang=language-code ]text
307
308 x-default is used by default if the value doesn't start with a
309 language qualifier.
310
311 An additional command is available to register XMP namespaces:
312
313 reg prefix namespace
314
315 Command file format
316 Empty lines and lines starting with # in a command file are ignored
317 (comments). Remaining lines are commands as described above.
318
320 exiv2 *.jpg
321 Prints a summary of the Exif information for all JPEG files in
322 the directory.
323
324 exiv2 -pi image.jpg
325 Prints the IPTC metadata of the image.
326
327 exiv2 rename img_1234.jpg
328 Renames img_1234.jpg (taken on 13-Nov-05 at 22:58:31) to
329 20051113_225831.jpg
330
331 exiv2 -r':basename:_%Y%m' rename img_1234.jpg
332 Renames img_1234.jpg to img_1234_200511.jpg
333
334 exiv2 -et img1.jpg img2.jpg
335 Extracts the Exif thumbnails from the two files into
336 img1-thumb.jpg and img2-thumb.jpg.
337
338 exiv2 -it img1.jpg img2.jpg
339 Inserts (copies) metadata from img1.exv to img1.jpg and from
340 img2.exv to img2.jpg.
341
342 exiv2 -ep1,2 image.jpg
343 Extracts previews 1 and 2 from the image to the files image-pre‐
344 view1.jpg and image-preview2.jpg.
345
346 exiv2 -eiX image.jpg
347 Extracts IPTC datasets into an XMP sidecar file image.xmp and in
348 the process converts them to "IPTC Core" XMP schema.
349
350 exiv2 -iixX image.jpg
351 Inserts IPTC and XMP metadata from an XMP sidecar file image.xmp
352 into image.jpg. The resulting IPTC datasets are converted from
353 the "IPTC Core" XMP schema properties in the sidecar file to the
354 older IPTC IIM4 format. The inserted XMP properties include
355 those in the "IPTC Core" XMP schema.
356
357 exiv2 -M"set Exif.Photo.UserComment charset=Ascii New Exif comment" image.jpg
358 Sets the Exif comment to an ASCII string.
359
360 exiv2 -M"set Exif.GPSInfo.GPSLatitude 4/1 15/1 33/1" \
361 -M"set Exif.GPSInfo.GPSLatitudeRef N" image.jpg
362 Sets the latitude to 4 degrees, 15 minutes and 33 seconds north.
363 The Exif standard stipulates that the GPSLatitude tag consists
364 of three Rational numbers for the degrees, minutes and seconds
365 of the latitude and GPSLatitudeRef contains either 'N' or 'S'
366 for north or south latitude respectively.
367
368 exiv2 insert -l/tmp -S.CRW /data/*.JPG
369 Copy all metadata from CRW files in the /tmp directory to JPG
370 files with corresponding basenames in the /data directory. Note
371 that this copies metadata as is, without any modifications to
372 adapt it to the requirements of the target format. Some tags
373 copied like this may not make sense in the target image.
374
376 http://www.exiv2.org/sample.html#modify
377 Sample command files.
378
379 http://www.exiv2.org/metadata.html
380 Taglists with key and default type values.
381
383 exiv2 was written by Andreas Huggel <ahuggel@gmx.net>.
384
385 This manual page was originally written by KELEMEN Peter
386 <fuji@debian.org>, for the Debian project.
387
388
389
390 Sep 10, 2010 EXIV2(1)