exiv2 - Image metadata manipulation tool
exiv2 [ option [ arg ] ]+ [ action ] file ...
exiv2 is a program to read and write image metadata, including Exif, IPTC, XMP, image comments, ICC Profile, thumbnails, image previews and many vendor makernote tags. The program optionally converts between Exif, IPTC and XMP tags, as recommended by their respective standards/specifications and the Metadata Working Group guidelines.
- SYNOPSIS
- DESCRIPTION
- FILE TYPES
- ACTIONS
- COMMAND SUMMARY
- OPTIONS
- EXIV2 GROUPS, TYPES AND VALUES
- PREVIEW IMAGES AND THUMBNAILS
- ICC PROFILES
- IMAGE COMMENTS
- 'MODIFY' COMMANDS
- CONFIGURATION FILE
- EXAMPLES
- RETURN VALUE
- ENVIRONMENT
- NOTES
- BUGS
- COPYRIGHT
- AUTHORS
- SEE ALSO
The following image formats and metadata categories are supported:
Type | Exif | IPTC | XMP | Image Comments | ICC Profile | Thumbnail |
---|---|---|---|---|---|---|
ARW | Read/Write | Read/Write | Read/Write | - | Read/Write | Read/Write |
AVIF | Read | Read | Read | - | - | Read |
BMP | - | - | - | - | - | - |
CR2 | Read/Write | Read/Write | Read/Write | - | Read/Write | Read/Write |
CR3 | Read | Read | Read | - | - | Read |
CRW | Read/Write | - | - | Read/Write | - | Read/Write |
DCP | Read/Write | - | - | - | - | - |
DNG | Read/Write | Read/Write | Read/Write | - | Read/Write | Read/Write |
EPS | - | - | Read/Write | - | - | |
EXV | Read/Write | Read/Write | Read/Write | Read/Write | Read/Write | Read/Write |
GIF | - | - | - | - | - | - |
HEIC | Read | Read | Read | - | - | Read |
HEIF | Read | Read | Read | - | - | Read |
JP2 | Read/Write | Read/Write | Read/Write | - | Read/Write | Read/Write |
JPEG | Read/Write | Read/Write | Read/Write | Read/Write | Read/Write | Read/Write |
JXL | Read | Read | Read | - | - | Read |
MRW | Read | Read | Read | - | - | Read |
NEF | Read/Write | Read/Write | Read/Write | - | Read/Write | Read/Write |
ORF | Read/Write | Read/Write | Read/Write | - | - | Read/Write |
PEF | Read/Write | Read/Write | Read/Write | - | Read/Write | Read/Write |
PGF | Read/Write | Read/Write | Read/Write | Read/Write | Read/Write | - |
PNG | - | Read/Write | Read/Write | - | Read/Write | Read/Write |
PSD | Read/Write | Read/Write | Read/Write | - | - | Read/Write |
RAF | Read | Read | Read | - | - | Read |
RW2 | Read | Read | Read | - | - | Read |
SR2 | Read | Read | Read | - | - | Read |
SRW | Read/Write | Read/Write | Read/Write | - | - | Read/Write |
TGA | - | - | - | - | - | - |
TIFF | Read/Write | Read/Write | Read/Write | - | Read/Write | Read/Write |
WEBP | Read/Write | - | Read/Write | - | Read/Write | Read/Write |
XMP | - | - | Read/Write | - | - | - |
-
Support for GIF, TGA and BMP images is minimal: the image format is recognized, a MIME type assigned to it and the height and width of the image are determined.
-
Reading other TIFF-like RAW image formats, which are not listed in the table, may also work.
-
Some image formats allow an extra internal type of metadata. Only partial support exists for the RAF format.
-
Support for BMFF types such as AVIF, CR3, HEIF and HEIC is a build option. To check if this is enabled, use
exiv2 --version --verbose --grep bmff
and see ifenable_bmff=1
. -
Naked codestream JXL files do not contain Exif, IPTC or XMP metadata.
-
Support of video files is limited. Currently exiv2 only has some rudimentary support to read metadata from quicktime, matroska and riff based video files (e.g. .MOV/.MP4, .MKV, .AVI, .WAV, .ASF).
The action argument is only required if it is not clear from the options which action is implied.
Print image metadata, the default is --print s. This is also
the default action (i.e., exiv2 image.jpg
).
Extract metadata to "raw" metadata (*.exv), XMP sidecar (*.xmp), preview image, thumbnail or ICC profile file. The default is --extract XXei. Use --location dir to direct the output to a different directory. Modification commands can be applied on-the-fly.
Insert metadata from corresponding "raw" metadata (*.exv), XMP sidecar (*.xmp), thumbnail or ICC profile files, the default is --insert XXeix. Use --location dir to direct the input from a different directory and --suffix suf for the output extension. Since files of any supported format can be used as input files, this command can be used to copy the metadata between files of different formats.
Delete image metadata from the files, the default is --delete a.
Adjust Exif timestamps by the given time. Requires at least one of the options --adjust time, --years +-n, --months +-n or --days +-n. See TZ environment variable.
Apply commands to modify the Exif, IPTC and XMP metadata of image files. Requires option --comment txt, --modify cmdfile or --Modify cmd.
Rename files and/or set file timestamps according to the Exif create timestamp. The default filename format is in --rename fmt. Uses the value of Exif.Photo.DateTimeOriginal or, Exif.Image.DateTime to determine the timestamp. The filename format can be set with --rename fmt, timestamp options are --timestamp and --Timestamp. See TZ environment variable.
Copy the ISO setting from one of the proprietary Nikon or Canon makernote ISO tags to the regular Exif ISO tag, Exif.Photo.ISOSpeedRatings. Does not overwrite an existing Exif ISO tag.
Fix the character encoding of Exif Unicode user comments. Decodes the comment using the auto-detected or specified character encoding and writes it back in UCS-2. Use option --encode enc to specify the current encoding of the comment if necessary.
exiv2 [ option [ arg ] ]+ [ action ] file ...
Where file is one or more files containing image metadata. These can optionally be specified using a URL (http, https, ftp, sftp, data and file supported) or a wildcard pattern (e.g., image1.tiff image2.jpg, https://www.exiv2.org/Stonehenge.jpg or *.jpg)
Option arg | Long option arg | Description |
---|---|---|
-a time | --adjust time | Automatically modify metadata time stamps. For the adjust action [...] |
-b | --binary | Obsolete and should not be used. Reserved for use with the test suite |
-c txt | --comment txt | JPEG comment string to set in the image. For the modify action [...] |
-d tgt1 | --delete tgt1 | Delete target(s) for the delete action [...] |
-D +-n | --days +-n | Automated adjustment of the days in metadata dates [...] |
-e tgt3 | --extract tgt3 | Extract target(s) for the extract action [...] |
-f | --force | Do not prompt before overwriting existing files. For the rename and extract actions [...] |
-F | --Force | Do not prompt before renaming files. For the rename and extract actions [...] |
-g str | --grep str | Only output where str matches in output text [...] |
-h | --help | Display help and exit [...] |
-i tgt2 | --insert tgt2 | Insert target(s) for the insert action [...] |
-k | --keep | Preserve file timestamps when updating files [...] |
-K key | --key key | Report a key. Similar to --grep str, however key must match exactly [...] |
-l dir | --location dir | Location (directory) for files to be inserted or extracted [...] |
-m cmdfile | --modify cmdfile | Read commands from a file. For the modify action [...] |
-M cmd | --Modify cmd | Modify the metadata with the command. For the modify action [...] |
-n enc | --encode enc | Charset to decode Exif Unicode user comments [...] |
-O +-n | --months +-n | Automated adjustment of the months in metadata dates [...] |
-p mod | --print mod | Print report (common reports) [...] |
-P flg | --Print flg | Print report (fine grained control) [...] |
-q | --quiet | Silence warnings and error messages [...] |
-Q lvl | --log lvl | Set the log-level [...] |
-r fmt | --rename fmt | Filename format for the rename action [...] |
-S suf | --suffix suf | Use suffix for source files when using the insert action [...] |
-t | --timestamp | Set the file timestamp from Exif metadata. For the rename action [...] |
-T | --Timestamp | Only set the file timestamp from Exif metadata. For the rename action [...] |
-u | --unknown | Show unknown tags [...] |
-v | --verbose | Verbose [...] |
-V | --version | Show the program version and exit [...] |
-Y +-n | --years +-n | Automated adjustment of the years in metadata dates [...] |
The arguments for those options are:
arg | Description |
---|---|
action | pr | ex | in | rm | ad | mo | mv | fi | fc (print, extract, insert, delete, adjust, modify, rename, fixiso, fixcom) |
cmd | (set | add) key [ [type] value ] | del key [type] | reg prefix namespace (see 'Modify' command format) |
enc | Values defined in iconv_open(3) (e.g., UTF-8) |
flg | E | I | X | x | g | k | l | n | y | c | s | v | t | h (Exif, IPTC, XMP, num, grp, key, label, name, type, count, size, vanilla, translated, hex) |
fmt | Default format: %Y%m%d_%H%M%S |
key | See Exiv2 key syntax |
lvl | d | i | w | e | m (debug, info, warning, error, mute) |
mod | s | a | e | t | v | h | i | x | c | p | C | R | S | X (summary, all, Exif, translated, vanilla, hex, IPTC, XMP, comment, preview, ICC Profile, Recursive Structure, Simple Structure, raw XMP) |
suf | '.' then the file's extension (e.g., '.txt') |
time | [+|-]HH[:MM[:SS]] (Default is + when +/- are missing) |
tgt1 | a | c | e | i | I | t | x | C | - (all, comment, Exif, IPTC, IPTC all, thumbnail, XMP, ICC Profile, stdin/out) |
tgt2 | a | c | e | i | t | x | C | X | XX | - (all, comment, Exif, IPTC, thumbnail, XMP, ICC Profile, SideCar, Raw metadata, stdin/out) |
tgt3 | a | e | i | p | t | x | C | X | XX | - (all, Exif, IPTC, preview, thumbnail, XMP, ICC Profile, SideCar, Raw metadata, stdin/out) |
type | An Exif, IPTC or XMP tag type (e.g., xmpText). See Exif/IPTC/XMP types |
+-n | The amount to change in the date (e.g., -3). Default is + when +/- are missing |
Display help and exit.
Show the program version and exit.
When --version is combined with --verbose, build information is printed to standard output along with a list of shared libraries which have been loaded into memory. Verbose version is supported on Windows (MSVC, Cygwin and MinGW builds), macOS and Linux and is provided for test and debugging. The library name and version number are always printed, even if output is filtered with --grep str.
Be verbose during the program run.
Silence warnings and error messages during the program run. Note that options --quiet and --verbose can be used at the same time.
Set the log-level to 'd'(ebug), 'i'(nfo), 'w'(arning), 'e'(rror) or 'm'(ute), with the lvl chosen including those below it ('d' <- 'i' <- 'w' <- 'e'). The default log-level is 'w'. --log m is equivalent to --quiet. All log messages are written to standard error.
Show unknown tags. Default is to suppress tags which don't have a name (e.g., Exif.SonyMisc3c.0x022b).
When printing tags, display only those where str is found in the key (see Exiv2 key syntax). When --grep str is used with --verbose --version, lines are included where str matches in the variable or value.
Multiple --grep str options can be used to output additional data:
$ exiv2 --verbose --version --grep webready --grep time
exiv2 1.0.0.9
time=11:01:53
enable_webready=1
xmlns=mediapro:http://ns.iview-multimedia.com/mediapro/1.0/
When the --print mod and --Print flgs options are not specified, the default is --print a:
$ curl --silent -O https://www.exiv2.org/Stonehenge.jpg
$ exiv2 --grep Date Stonehenge.jpg
Exif.Image.DateTime Ascii 20 2015:07:16 20:25:28
Exif.Photo.DateTimeOriginal Ascii 20 2015:07:16 15:38:54
Exif.Photo.DateTimeDigitized Ascii 20 2015:07:16 15:38:54
Exif.NikonWt.DateDisplayFormat Byte 1 Y/M/D
Exif.GPSInfo.GPSDateStamp Ascii 11 2015:07:16
Xmp.xmp.ModifyDate XmpText 25 2015-07-16T20:25:28+01:00
You may use --print mod or --Print flgs to further filter output (--print s is ignored):
$ exiv2 --print x --grep Date Stonehenge.jpg
Xmp.xmp.ModifyDate XmpText 25 2015-07-16T20:25:28+01:00
str can contain an optional /i modifier at the end, to indicate case insensitivity:
$ exiv2 --print px --grep date/i Stonehenge.jpg
Xmp.xmp.ModifyDate XmpText 25 2015-07-16T20:25:28+01:00
Only reports tags for a given key, which must match the key exactly (See Exiv2 key syntax).
Multiple --key key options can be used to report more than a single key:
$ curl --silent -O https://www.exiv2.org/Stonehenge.jpg
$ exiv2 --key Exif.Photo.DateTimeDigitized --key Exif.Photo.DateTimeOriginal Stonehenge.jpg
Exif.Photo.DateTimeOriginal Ascii 20 2015:07:16 15:38:54
Exif.Photo.DateTimeDigitized Ascii 20 2015:07:16 15:38:54
Charset to use when decoding Exif Unicode user comments, where enc is a name understood by iconv_open(3) (e.g., 'UTF-8'). See Exif 'Comment' values.
Preserve file timestamps when updating files. Can be used with all options which update files and is ignored by read-only options.
Set the file timestamp according to the Exif create timestamp in addition to renaming the file (overrides --keep). This option is only used with the rename action. See TZ environment variable.
Only set the file timestamp according to the Exif create timestamp, do not rename the file (overrides --keep). This option is only used with the rename action. See TZ environment variable.
These options are used by the rename and extract actions to determine the file overwrite policy. The options override the default behavior, which is to prompt the user if the filename already exists. These options are usually combined with --verbose, to provide additional status output.
The rename action will overwrite files when --force is used. Instead, if --Force is used and the file already exists, the new filename is appended with '_1' ('_2', ...) to prevent data loss.
The extract action will overwrite files when either --force or --Force is used.
For example, renaming a file using --Force, where the same filename has already been renamed:
$ curl --silent -O https://www.exiv2.org/Stonehenge.jpg
$ exiv2 --verbose --Force rename Stonehenge.jpg
File 1/1: Stonehenge.jpg
Renaming file to ./20150716_153854.jpg
$ curl --silent -O https://www.exiv2.org/Stonehenge.jpg
$ exiv2 --verbose --Force rename Stonehenge.jpg
File 1/1: Stonehenge.jpg
Renaming file to ./20150716_153854_1.jpg
Filename format for the rename action (See TZ environment variable). The fmt string follows the definitions in strftime(3), using Exif.Photo.DateTimeOriginal or Exif.Image.DateTime as the reference date and time. In addition, the following special character sequences are also provided:
Variable | Description |
---|---|
:basename: | Original filename without extension |
:basesuffix: | Suffix in original filename, starts with first dot and ends before extension, e.g. PANO, MP, NIGHT added by Google Camera app |
:dirname: | Name of the directory holding the original file |
:parentname: | Name of parent directory |
The default fmt is %Y%m%d_%H%M%S
For example, renaming a file when fmt is made up of the basename, day, short month and long year:
$ curl --silent -O https://www.exiv2.org/Stonehenge.jpg
$ exiv2 --verbose --rename ':basename:_%d_%b_%Y' Stonehenge.jpg
File 1/1: Stonehenge.jpg
Renaming file to ./Stonehenge_16_Jul_2015.jpg
If the filename to rename to already exists and --Force and --force are not used, the user is prompted for an action.
Option | Description |
---|---|
[O]verwrite | Rename the file, overriding the existing one |
[r]ename | Rename the file, but append '_1' ('_2', ...) to the new filename |
[s]kip : | Cancel renaming this file |
For example, when renaming a second Stonehenge.jpg file:
$ curl --silent -O https://www.exiv2.org/Stonehenge.jpg
$ exiv2 --verbose --rename ':basename:_%d_%b_%Y' Stonehenge.jpg
File 1/1: Stonehenge.jpg
exiv2.exe: File `./Stonehenge_16_Jul_2015.jpg' exists. [O]verwrite, [r]ename or [s]kip? r
Renaming file to ./Stonehenge_16_Jul_2015_1.jpg
If the filename contains a suffix, which shall be included in new filename:
$ exiv2 --verbose --rename '%d_%b_%Y:basesuffix:' Stonehenge.PANO.jpg
File 1/1: Stonehenge.PANO.jpg
Renaming file to '16_Jul_2015.PANO'.jpg```
<div id="adjust_time">
### **-a** *time*, **--adjust** *time*
Adjusts the times in standard Exif tags, where *time* is in the format:
[+\|-]HH[:MM[:SS]]. This option is only used with the [adjust](#ad_adjust)
action. See [TZ](#TZ) environment variable.
Examples of *time* are:
| Time | Description |
|:------ |:---- |
| +1 | Adds one hour |
| 1:01 | Adds one hour and one minute |
| -0:00:30 | Subtracts 30 seconds |
<div id="years_n">
### **-Y** *+-n*, **--years** *+-n*
Time adjustment by a positive or negative number of years, for
the [adjust](#ad_adjust) action. See [TZ environment variable](#TZ).
<div id="months_n">
### **-O** *+-n*, **--months** *+-n*
Time adjustment by a positive or negative number of months, for
the [adjust](#ad_adjust) action. See [TZ environment variable](#TZ).
<div id="days_n">
### **-D** *+-n*, **--days** *+-n*
Time adjustment by a positive or negative number of days, for
the [adjust](#ad_adjust) action. See [TZ environment variable](#TZ).
<div id="print_mod">
### **-p** *mod*, **--print** *mod*
Print mode for the [print](#pr_print) action (see
[DESCRIPTION](#file_types), for metadata support in a file type).
Where *mod* is one of:
| Option | Description |
|:------ |:---- |
| s | A summary of the Exif metadata (the default for the [print](#pr_print) action) |
| a | Exif, IPTC and XMP tags (shortcut for [--Print kyct](#Print_flgs)) |
| e | Plain (untranslated) Exif tags (shortcut for [--Print Ekycv](#Print_flgs)) |
| t | Interpreted (translated) Exif tag values (shortcut for [--Print Ekyct](#Print_flgs)) |
| v | Plain (untranslated) Exif tag values (shortcut for [--Print Exgnycv](#Print_flgs)) |
| h | Hex dump of the Exif data (shortcut for [--Print Exgnycsh](#Print_flgs)) |
| i | Translated IPTC tags (shortcut for [--Print Ikyct](#Print_flgs)) |
| x | Translated XMP tags (shortcut for [--Print Xkyct](#Print_flgs)) |
| c | JPEG comment (see [IMAGE COMMENTS](#image_comments)) |
| p | List available image previews, sorted by size in pixels (see [PREVIEW IMAGES AND THUMBNAILS](#preview_images)) |
| C | Image ICC Profile (see [ICC PROFILES](#icc_profiles)) |
| R | Print image structure recursively (only for the 'debug' build with jpg, png, tiff, webp, cr2 and jp2 types) |
| S | Image structure information (jpg, png, tiff, webp, cr2 and jp2 types only) |
| X | "raw" XMP |
**--print** *mod* can be combined with [--grep str](#grep_str) or
[--key key](#key_key) to further filter the output.
For the order of the columns in the output, see
[--Print flgs](#Print_flgs_order).
<div id="Print_flgs">
### **-P** *flgs*, **-Print** *flgs*
Print flags allows fine control of the tag list for the
[print](#pr_print) action (see [DESCRIPTION](#file_types), for metadata
support in a file type). The option allows control of the type of metadata
as well as data columns included in the print output. Valid flags are:
| Option | Description |
|:------ |:---- |
| E | Exif tags |
| I | IPTC tags |
| X | XMP tags |
| x | Tag number for Exif or IPTC tags (in hexadecimal) |
| g | Group name (e.g., for Exif.Photo.UserComment, outputs Photo) |
| k | Key (e.g., Exif.Photo.UserComment) |
| l | Tag label (human-readable tagname, e.g., for Exif.Photo.UserComment, outputs 'User comment') |
| d | Tag description |
| n | Tag name (e.g., for Exif.Photo.UserComment, outputs UserComment) |
| y | Type (for available types, see [Exif/IPTC/XMP types](#exiv2_types)) |
| c | Number of components (for single entry types, the number of **sizeof('type')** in 'size'. For multi-entry types, the number of entries. See [Exif/IPTC/XMP types](#exiv2_types)) |
| s | Size in bytes of vanilla output (see note in [Exif 'Comment' values](#exif_comment_values)). Some types include a *NULL* character in the size (see [Exif/IPTC/XMP types](#exiv2_types)) |
| v | Plain data value (vanilla values, i.e., untranslated) |
| V | Plain data value, data type and the word 'set' (see ['MODIFY' COMMANDS](#modify_cmds))|
| t | Interpreted (translated) human-readable data values (includes plain vanilla values) |
| h | Hex dump of the data |
**--Print** *flgs* can be combined with [--grep str](#grep_str) or
[--key key](#key_key) to further filter the output.
<div id="Print_flgs_order">
The order of the values in *flgs* is not respected and is output as follows:
| Tag number<br>(x) | Plain 'set'<br>(V) | Group<br>(g) | Key<br>(k) | Tagname<br>(n) | Tagname label<br>(l) |Description<br>(d) | Type<br>(y) | Comp<br>(c) | Size<br>(s) | Value<br>(v) | Translated<br>(t) |
|:------ |:---- |:------ |:------ |:------ |:------ |:------ |:------ |:------ |:------ |:--- |:------ |
For example,
```bash
$ curl --silent -O https://www.exiv2.org/Stonehenge.jpg
$ exiv2 --Print xVgknldycsvt -K Exif.Nikon3.Quality Stonehenge.jpg
0x0004 set Nikon3 Exif.Nikon3.Quality Quality Quality Image quality setting Ascii 8 8 NORMAL NORMAL
Delete target(s) for the delete action. Possible targets are:
Option | Description |
---|---|
a | All supported metadata (the default for the delete action) |
e | Exif tags |
t | Exif thumbnail only (see PREVIEW IMAGES AND THUMBNAILS) |
i | IPTC tags |
x | XMP tags |
c | JPEG comment (see IMAGE COMMENTS) |
C | ICC Profile (see ICC PROFILES) |
I | All IPTC data (removes broken metadata containing multiple IPTC blocks) |
- | Insert from stdin. This option is intended for "filter" operations |
Insert target(s) for the insert action (see DESCRIPTION, for metadata support in a file type). Possible targets are:
Option | Description |
---|---|
a | All supported metadata (the default for the insert action) |
e | Exif tags |
t | Exif thumbnail only. Only JPEG thumbnails can be inserted from a file called <file>-thumb.jpg (see PREVIEW IMAGES AND THUMBNAILS) |
i | IPTC tags |
x | XMP tags |
c | JPEG comment (see IMAGE COMMENTS) |
C | ICC Profile, inserted from a file called <file>.icc (see ICC PROFILES) |
X | Insert metadata from an XMP sidecar file, <file>.xmp. The remaining targets determine which metadata to include, possible are Exif, IPTC and XMP (default is all of these). Inserted XMP tags include those converted to Exif and IPTC |
XX | Insert "raw" metadata from a sidecar file, <file>.exv |
- | Insert from stdin. This option is intended for "filter" operations |
To insert from a location other than the current directory, use --location dir.
Filter operations between --extract tgt3 and --insert tgt2 are possible, using the following template; xmllint(1) can be optionally used when extracting XMP sidecar files:
$ exiv2 -e{tgt3}- filename | [ xmllint .... |] exiv2 -i{tgt2}- filename
Extract target(s) for the extract action. Possible targets are:
Option |
Description |
---|---|
a | All supported metadata (the default for the extract action) |
e | Exif tags |
t | Extract Exif thumbnail only to a file called <file>-thumb.jpg (see PREVIEW IMAGES AND THUMBNAILS) |
i | IPTC tags |
x | XMP tags |
c | JPEG comment (see IMAGE COMMENTS) |
p[<n>[,<m> ...]] | Extract preview images to files called <file>-preview<n | m | ...>.<ext> (see PREVIEW IMAGES AND THUMBNAILS) |
C | Extract ICC profile, to a file called <file>.icc (see ICC PROFILES) |
X | Extract metadata to an XMP sidecar file, <file>.xmp. Other targets cannot be used with this, as only XMP data is written. Extracted XMP tags include those converted from Exif and IPTC |
XX | Extract "raw" metadata to a sidecar file, <file>.exv. The remaining targets determine which metadata to include, possible are Exif and IPTC (XMP is always included) |
- | Output to stdout (see example in --insert tgt2). This ignores --verbose and only allows extracting from 1 file |
To extract to a location other than the current directory, use --location dir.
When extracting, the --Modify cmd and --modify cmdfile options can be used to filter the output (see 'MODIFY' COMMANDS). For example, extracting Exif and IPTC "raw" metadata and adding an Xmp.dc.subject value.
$ curl --silent -O https://www.exiv2.org/Stonehenge.jpg
$ exiv2 --extract XXei --Modify "add Xmp.dc.subject Monument" Stonehenge.jpg
$ exiv2 --key Xmp.dc.subject Stonehenge.exv
Xmp.dc.subject XmpBag 1 Monument
JPEG comment string to set in the image (modify action) (see IMAGE COMMENTS).
Commands for the modify action (see Command file format). In the format:
--modify ( file | - )
Parameter | Description |
---|---|
file | The file containing the 'modify' commands |
- | Stdin |
This option can also be used with the extract actions to modify metadata on-the-fly. See 'MODIFY' COMMANDS.
Command line for the modify action. This option can also be used with the extract action to modify metadata on-the-fly. See 'MODIFY' COMMANDS and 'Modify' command file.
Location (directory) for files to be inserted from or extracted to.
Use suffix suf for source files when using insert action (e.g., '.txt').
Exiv2 supports Exif 2.32, Adobe XMP 4.4.0 by default, although can be built with newer versions of the SDK, and many manufacturer's makernote tags.
The standard format for Exif and IPTC tags is:
Family.Group.Tagname
Definition | Description |
---|---|
Family | Either 'Exif' or 'Iptc' |
Group | The group within the family. e.g., for Exif, 'Image' |
Tagname | The tagname within a family and group. e.g., For Exif.Image, 'Model' |
For example, Exif.Image.Model or Iptc.Application2.Subject .
In addition to the standard key syntax, XMP can also use an extended format:
Family.Group.Tagname[ <index>[ <value_types> ] ]+
Definition | Description |
---|---|
Family | i.e., 'Xmp' |
Group | The group within the family. e.g., for Xmp, 'dc' |
Tagname | The tagname within a family and group. e.g., For Xmp.dc, 'subject' |
<index> | An integer (1,...,n) surrounded by square brackets (e.g., [n], is the n'th item in the 'array') |
<value_types> | This is /name1 : name2 (e.g., /dim:length). Within a Family.Group.Tagname[n] and nested arrays, only one type of /name1 identifier is allowed, but many name2 values |
For example, the Xmp.xmpMM.History tag would use the extended key:
Xmp.xmpMM.History[1]/stEvt:action
Nested structures are permitted and use multiple [ <index>[ <value_types> ] ] in the key. For example, if an Xmp.xmpMM.History tag defined an additional nested array struct, the extended key would be:
Xmp.xmpMM.History[1]/stEvt:myArray[1]/myName1:myName2
See XMP structs and Setting an XMP struct value.
More information about XMP keys and conventions for <value_types> is available from: https://www.adobe.com/content/dam/acom/en/devnet/xmp/pdfs/XMPSDKReleasecc-2020/XMPSpecificationPart2.pdf#G4.1132618