Add README-SAMPLES.md and remove exiv2samples.1 (#921)

* Add README-SAMPLES.md and remove exiv2samples.1
* Remove samples man page from CMake
* Add all sample programs to Doxygen.
* Adding links to source code on exiv2.org

Authored-By: Robin Mills <robin@clanmills.com>
Authored-By: Luis Díaz Más <piponazo@gmail.com>
v0.27.3
Robin Mills 6 years ago committed by D4N
parent 4061111aca
commit 0a47d93ccf

@ -0,0 +1,603 @@
![Exiv2](exiv2.png)
# Exiv2 Sample Applications
Exiv2 is a C++ library and a command line utility to read, write, delete and modify Exif, IPTC, XMP and ICC image metadata. Exiv2 also features a collection of sample and test command-line programs. Please be aware that while the program _**exiv2**_ enjoys full support from Team Exiv2, the other programs have been written for test, documentation or development purposes. You are expected to read the code to discover the specification of programs other than _**exiv2**_.
[Sample](#TOC1) Programs [Test](#TOC2) Programs
<div id="TOC1">
### Sample Programs
| Name | Purpose | More information | Code |
|:--- |:--- |:--- |:-- |
| _**addmoddel**_ | Demonstrates Exiv2 library APIs to add, modify or delete metadata | [addmoddel](#addmoddel) | [addmoddel.cpp](samples/addmoddel.cpp) |
| _**exifcomment**_ | Set Exif.Photo.UserComment in an image | [exifcomment](#exifcomment) | [exifcomment.cpp](samples/exifcomment.cpp) |
| _**exifdata**_ | Prints _**Exif**_ metadata in different formats in an image | [exifdata](#exifdata) | [exifdata.cpp](samples/exifdata.cpp) |
| _**exifprint**_ | Print _**Exif**_ metadata in images<br>Miscelleous other features | [exifprint](#exifprint)| [exifprint.cpp](samples/exifprint.cpp) |
| _**exifvalue**_ | Prints the value of a single _**Exif**_ tag in a file | [exifvalue](#exifvalue) | [exifvalue.cpp](samples/exifvalue.cpp) |
| _**exiv2**_ | Command line utility to read, write, delete and modify Exif, IPTC, XMP and ICC image metadata.<br>This is the primary test tool used by Team Exiv2 and can exercise almost all code in the library. Due to the extensive capability of this utility, the APIs used are usually less obvious for casual code inspection. | [https://exiv2.org/manpage.html](https://exiv2.org/manpage.html)<br>[https://exiv2.org/sample.html](https://exiv2.org/sample.html) | |
| _**exiv2json**_ | Extracts data from image in JSON format.<br>This program also contains a parser to recursively parse Xmp metadata into vectors and objects. | [exiv2json](#exiv2json) | [exiv2json.cpp](samples/exiv2json.cpp) |
| _**geotag**_ | Reads GPX data and updates images with GPS Tags | [geotag](#geotag) | [geotag.cpp](samples/geotag.cpp) |
| _**iptceasy**_ | Demonstrates read, set or modify IPTC metadata | [iptceasy](#iptceasy) | [iptceasy.cpp](samples/iptceasy.cpp) |
| _**iptcprint**_ | Demonstrates Exiv2 library APIs to print Iptc data | [iptceasy](#iptceasy) | [iptcprint.cpp](samples/iptcprint.cpp) |
| _**metacopy**_ | Demonstrates copying metadata from one image to another | [metacopy](#metacopy) | [metacopy.cpp](samples/metacopy.cpp) |
| _**mrwthumb**_ | Sample program to extract a Minolta thumbnail from the makernote | [mrwthumb](#mrwthumb) | [mrwthumb.cpp](samples/mrwthumb.cpp) |
| _**xmpparse**_ | Read an XMP packet from a file, parse it and print all (known) properties. | [xmpparse](#xmpparse) | [xmpparse.cpp](samples/xmpparse.cpp) |
| _**xmpprint**_ | Read an XMP from a file, parse it and print all (known) properties.. | [xmpprint](#xmpprint) | [xmpprint.cpp](samples/xmpprint.cpp) |
| _**xmpsample**_ | Demonstrates Exiv2 library high level XMP classes | [xmpsample](#xmpsample) | [xmpsample.cpp](samples/exmpsample.cpp) |
[Sample](#TOC1) Programs [Test](#TOC2) Programs
<div id="TOC2">
### Test Programs
As Exiv2 is open source, we publish all our materials. Some of the following programs are actively used in our test harness. Some of the following programs were written during the development of features and their on-going use may be limited, or even obsolete. In general these programs are published as source and Team Exiv2 will not provide support to users.
| Name | Kind | More information |
|:--- |:--- |:--- |
| _**conntest**_ | Test http/https/ftp/ssh/sftp connection | [conntest](#conntest) |
| _**convert-test**_ | Conversion test driver | [convert-test](#convert-test) |
| _**easyaccess-test**_ | Sample program using high-level metadata access functions | [easyaccess-test](#easyaccess-test) |
| _**getopt-test**_ | Sample program to test getopt() | [getopt-test](#getopt-test) |
| _**ini-test**_ | Shows simple usage of the INIReader class | [ini-test](#ini-test) |
| _**iotest**_ | Test programs for BasicIo functions. | [iotest](#iotest) |
| _**iptctest**_ | Sample program test Iptc reading and writing. | [iptctest](#iptctest) |
| _**key-test**_ | Key unit tests | [key-test](#key-test) |
| _**largeiptc-test**_ | Test for large (>65535 bytes) IPTC buffer | [largeiptc-test](#largeiptc-test) |
| _**mmap-test**_ | Simple mmap tests | [mmap-test](#mmap-test) |
| _**path-test**_ | Test path IO | [path-test](#path-test) |
| _**prevtest**_ | Test access to preview images | [prevtest](#prevtest) |
| _**remotetest**_ | Tester application for testing remote i/o. | [remotetest](#remotetest) |
| _**stringto-test**_ | Test conversions from string to long, float and Rational types. | [stringto-test](#stringto-test) |
| _**taglist**_ | Print a simple comma separated list of tags defined in Exiv2 | [taglist](#taglist) |
| _**tiff-test**_ | Simple TIFF write test | [tiff-test](#tiff-test) |
| _**werror-test**_ | Simple tests for the wide-string error class WError | [werror-test](#werror-test) |
| _**write-test**_ | ExifData write unit tests | [write-test](#write-test) |
| _**write2-test**_ | ExifData write unit tests for Exif data created from scratch | [write2-test](#write2-test) |
| _**xmpdump**_ | Sample program to dump the XMP packet of an image | [xmpdump](#xmpdump) |
| _**xmpparser-test**_ | Read an XMP packet from a file, parse and re-serialize it. | [xmpparser-test](#xmpparser-test) |
[Sample](#TOC1) Programs [Test](#TOC2) Programs
## 2 Sample Program Descriptions
<div id="addmoddel">
#### addmoddel
```
Usage: addmoddel file
```
Demonstrates Exiv2 library APIs to add, modify or delete metadata. _Code: [addmoddel.cpp](samples/addmoddel.cpp)_
[Sample](#TOC1) Programs [Test](#TOC2) Programs
<div id="exifcomment">
#### exifcomment
```
Usage: exifcomment file
```
This is a simple program that demonstrates how to set _**Exif.Photo.UserComment**_ in an image. _Code: [exifcomment.cpp](samples/exifcomment.cpp)_
[Sample](#TOC1) Programs [Test](#TOC2) Programs
<div id="exifdata">
### exifdata
```
Usage: exifdata file format
formats: csv | json | wolf | xml
```
This is a simple program to demonstrate dumping _**Exif**_ metadata in common formats. _Code: [exifdata.cpp](samples/exifdata.cpp)_
[Sample](#TOC1) Programs [Test](#TOC2) Programs
<div id="exifprint">
#### exifprint
```
Usage: exifprint [ file | --version | --version-test ]
```
| Arguments | Description |
|:-- |:--- |
| file | Path to image |
| --version | Print version information from build |
| --version-test | Tests Exiv2 VERSION API |
This program demonstrates how to print _**Exif**_ metadata in an image. This program is also discussed in the platform ReadMe.txt file included in a build bundle. The option **--version** was added enable the user to build a test application which dumps the build information. The option **--version-test** was added to test the macro EXIV2\_TEST\_VERSION() in **include/exiv2/version.hpp**.
There is one other unique feature of this program. It is the only test/sample program which can use the EXV\_UNICODE\_PATH build feature of Exiv2 on Windows.
_Code: [exifprint.cpp](samples/exifprint.cpp)_
[Sample](#TOC1) Programs [Test](#TOC2) Programs
<div id="exifvalue">
#### exifvalue
```
Usage: exifvalue file tag
```
Prints the value of a single _**Exif**_ tag in a file. _Code: [exifvalue.cpp](samples/exifvalue.cpp)_
[Sample](#TOC1) Programs [Test](#TOC2) Programs
<div id="exiv2json">
#### exiv2json
```
Usage: exiv2json [-option] file
Option: all | exif | iptc | xmp | filesystem
```
| Arguments | Description |
|:-- |:--- |
| all | All metadata |
| filesystem | Filesystem metadata |
| exif | Exif metadata |
| iptc | Iptc metadata |
| xmp | Xmp metadata |
| file | path to image |
This program dumps metadata from an image in JSON format. _Code: [exiv2json.cpp](samples/exiv2json.cpp)_
exiv2json has a recursive parser to encode XMP into Vectors and Objects. XMP data is XMP and can contain XMP `Bag` and `Seq` which are converted to JSON Objects and Arrays. Exiv2 presents data in the format: Family.Group.Tag. For XMP, results in "flat" output such such as:
```
$ exiv2 -px ~/Stonehenge.jpg
Xmp.xmp.Rating XmpText 1 0
Xmp.xmp.ModifyDate XmpText 25 2015-07-16T20:25:28+01:00
Xmp.dc.description LangAlt 1 lang="x-default" Classic View
```
exiv2json parses the Exiv2 'Family.Group.Tag' data and restores the structure of the original data in JSON. _Code: [exiv2json.cpp](samples/exiv2json.cpp)_
```
$ exiv2json -xmp http://clanmills.com/Stonehenge.jpg
{
"Xmp": {
"xmp": {
"Rating": "0",
"ModifyDate": "2015-07-16T20:25:28+01:00"
},
"dc": {
"description": {
"lang": {
"x-default": "Classic View"
}
}
},
"xmlns": {
"dc": "http:\/\/purl.org\/dc\/elements\/1.1\/",
"xmp": "http:\/\/ns.adobe.com\/xap\/1.0\/"
}
}
}
$
```
[Sample](#TOC1) Programs [Test](#TOC2) Programs
<div id="geotag">
#### geotag
```
Usage: geotag {-help|-version|-dst|-dryrun|-ascii|-verbose|-adjust value|-tz value|-delta value}+ path+
```
Geotag reads one or more GPX files and adds GPS Tages to images. _Code: [geotag.cpp](samples/geotag.cpp)_
If the path is a directory, geotag will read all the files in the directory. It constructs a time dictionary of position data, then updates every image with GPS Tags.
| Arguments | Description |
|:-- |:--- |
| -ascii | Output in ascii (not UTF8). Prints `deg` instead of &deg;. |
| -dst | Apply 1 hour adjustment for daylight saving time. |
| -dryrun | Read arguments and print report. Does not modify images. |
| -verbose | Report progress. |
| -adjust value | Add/subtract time from image data. |
| -tz value | Specify time zone. For example PST = -8:00 |
| -delta value | Correction between Image DataTime and GPS time. |
I use this program frequently. I have a little Canon camera which I take when I run. My Samsung Galaxy Watch uploads my runs to Strava and I download the GPX. If I'm in another time-zone and have forgotten to change the time setting in the camera, I use `-adjust` to alter the images. The GPX time is always correct, however the camera is normally off by seconds or minutes. This option enables you to correct for inaccuracy in the setting of the camera time.
[Sample](#TOC1) Programs [Test](#TOC2) Programs
<div id="iptceasy">
#### iptceasy
```
Usage: iptceasy file
Reads and writes raw metadata. Use -h option for help.
```
Demonstrates read, set or modify IPTC metadata. _Code: [iptceasy.cpp](samples/iptceasy.cpp)_
[Sample](#TOC1) Programs [Test](#TOC2) Programs
<div id="iptcprint">
#### iptcprint
```
Usage: iptcprint file
Reads and writes raw metadata. Use -h option for help.
```
Demonstrates Exiv2 library APIs to print Iptc data. _Code: [iptcprint.cpp](samples/iptcprint.cpp)_
[Sample](#TOC1) Programs [Test](#TOC2) Programs
<div id="metacopy">
#### metacopy
```
Usage: metacopy [-iecaph] readfile writefile
Reads and writes raw metadata. Use -h option for help.
```
Metacopy is used to copy a complete metadata block from one file to another. _Code: [metacopy.cpp](samples/metacopy.cpp)_
Please note that some metadata such as Exif.Photo.PixelXDimension is considered to be part of the image and will not be copied.
[Sample](#TOC1) Programs [Test](#TOC2) Programs
<div id="mrwthumb">
#### mrwthumb
```
Usage: mrwthumb file
```
Sample program to extract a Minolta thumbnail from the makernote. _Code: [mrwthumb.cpp](samples/mrwthumb.cpp)_
[Sample](#TOC1) Programs [Test](#TOC2) Programs
<div id="xmpparse">
#### xmpparse
```
Usage: xmpparse file
```
Read an XMP packet from a file, parse it and print all (known) properties. _Code: [xmpparse.cpp](samples/xmpparse.cpp)_
[Sample](#TOC1) Programs [Test](#TOC2) Programs
<div id="xmpprint">
#### xmpprint
```
Usage: xmpprint file
```
Read an XMP from a file, parse it and print all (known) properties. _Code: [xmpprint.cpp](samples/xmpprint.cpp)_
[Sample](#TOC1) Programs [Test](#TOC2) Programs
<div id="xmpsample">
#### xmpsample
```
Usage: xmpsample file
```
Demonstrates Exiv2 library high level XMP classes. _Code: [xmpsample.cpp](samples/xmpsample.cpp)_
[Sample](#TOC1) Programs [Test](#TOC2) Programs
## 3 Test Program Descriptions
<div id="conntest">
#### conntest
```
Usage: conntest url {-http1_0}
```
Test http/https/ftp/ssh/sftp connection
[Sample](#TOC1) Programs [Test](#TOC2) Programs
<div id="convert-test">
#### convert-test
```
Usage: convert-test file
```
Conversion test driver
[Sample](#TOC1) Programs [Test](#TOC2) Programs
<div id="easyaccess-test">
#### easyaccess-test
```
Usage: easyaccess-test file
```
Sample program using high-level metadata access functions
[Sample](#TOC1) Programs [Test](#TOC2) Programs
<div id="getopt-test">
#### getopt-test
```
Usage: getopt-test
```
This program is used to test the function **getopt()**. Prior to Exiv2 v0.27, the sample programs used the platform's C Runtime Library function **getopt()**. Visual Studio builds used code in src/getopt.cpp. Due to differences in the platform **getopt()**, the code in src/getopt.cpp was modified and adopted on every platforms. This test program was added for test and debug purpose. Please note that src/getopt.cpp is compiled and linked into the sample application and is not part of the Exiv2 library.
[Sample](#TOC1) Programs [Test](#TOC2) Programs
<div id="ini-test">
#### ini-test
```
Usage: ini-test
```
This program is used to test reading the file ini-test. This program was added in Exiv2 v0.26 when the ~/.exiv2 file was added to the Exiv2 architecture.
[Sample](#TOC1) Programs [Test](#TOC2) Programs
<div id="iotest">
#### iotest
```
Usage: iotest filein fileout1 fileout2
fileouts are overwritten and should match filein exactly
```
Test programs for BasicIo functions.
[Sample](#TOC1) Programs [Test](#TOC2) Programs
<div id="iptctest">
#### iptctest
```
Usage: iptctest image
Commands read from stdin.
```
Sample program test Iptc reading and writing.
[Sample](#TOC1) Programs [Test](#TOC2) Programs
<div id="key-test">
#### key-test
```
Usage: key-test
```
Key unit tests
[Sample](#TOC1) Programs [Test](#TOC2) Programs
<div id="largeiptc-test">
#### largeiptc-test
```
Usage: largeiptc-test image datafile
```
Test for large (>65535 bytes) IPTC buffer
[Sample](#TOC1) Programs [Test](#TOC2) Programs
<div id="mmap-test">
#### mmap-test
```
Usage: mmap-test file
```
Simple mmap tests
[Sample](#TOC1) Programs [Test](#TOC2) Programs
<div id="path-test">
#### path-test
```
Usage: path-test file
```
Test path IO
[Sample](#TOC1) Programs [Test](#TOC2) Programs
<div id="prevtest">
#### prevtest
```
Usage: prevtest file
```
Test access to preview images
[Sample](#TOC1) Programs [Test](#TOC2) Programs
<div id="remotetest">
#### remotetest
```
Usage: remotetest remotetest file {--nocurl | --curl}
```
Tester application for testing remote i/o.
[Sample](#TOC1) Programs [Test](#TOC2) Programs
<div id="stringto-test">
#### stringto-test
```
Usage: stringto-test
```
Test conversions from string to long, float and Rational types.
[Sample](#TOC1) Programs [Test](#TOC2) Programs
<div id="taglist">
#### taglist
```
Usage: taglist [--group name|Groups|Exif|Canon|CanonCs|CanonSi|CanonCf|Fujifilm|Minolta|Nikon1|Nikon2|Nikon3|Olympus|Panasonic|Pentax|Sigma|Sony|Iptc|dc|xmp|xmpRights|xmpMM|xmpBJ|xmpTPg|xmpDM|pdf|photoshop|crs|tiff|exif|aux|iptc]
Print Exif tags, MakerNote tags, or Iptc datasets
```
Print a simple comma separated list of tags defined in Exiv2
This program encodes the library's tag definitions in ascii.
The data from this program is formatted as HTML on the web-site. https://exiv2.org/metadata.html
For example, to show the binary definition of Group `Nikon3`:
```
1516 rmills@rmillsmbp:~/gnu/github/exiv2/0.27-maintenance $ taglist Nikon3
Version, 1, 0x0001, Nikon3, Exif.Nikon3.Version, Undefined, Nikon Makernote version
ISOSpeed, 2, 0x0002, Nikon3, Exif.Nikon3.ISOSpeed, Short, ISO speed setting
ColorMode, 3, 0x0003, Nikon3, Exif.Nikon3.ColorMode, Ascii, Color mode
Quality, 4, 0x0004, Nikon3, Exif.Nikon3.Quality, Ascii, Image quality setting
WhiteBalance, 5, 0x0005, Nikon3, Exif.Nikon3.WhiteBalance, Ascii, White balance
Sharpening, 6, 0x0006, Nikon3, Exif.Nikon3.Sharpening, Ascii, Image sharpening setting
Focus, 7, 0x0007, Nikon3, Exif.Nikon3.Focus, Ascii, Focus mode
FlashSetting, 8, 0x0008, Nikon3, Exif.Nikon3.FlashSetting, Ascii, Flash setting
FlashDevice, 9, 0x0009, Nikon3, Exif.Nikon3.FlashDevice, Ascii, Flash device
...
```
We can see those tags being used:
```
$ exiv2 -pa --grep Nikon3 http://clanmills.com/Stonehenge.jpg
1519 rmills@rmillsmbp:~/gnu/github/exiv2/0.27-maintenance $ exiv2 -pa --grep Nikon3 http://clanmills.com/Stonehenge.jpg
Exif.Nikon3.Version Undefined 4 2.11
Exif.Nikon3.ISOSpeed Short 2 200
1520 rmills@rmillsmbp:~/gnu/github/exiv2/0.27-maintenance $
...
```
This information is formatted (search Nikon (format 3) MakerNote Tags): [https://exiv2.org/tags-nikon.html](https://exiv2.org/tags-nikon.html)
[Sample](#TOC1) Programs [Test](#TOC2) Programs
<div id="tiff-test">
#### tiff-test
```
Usage: tiff-test file
```
Simple TIFF write test
[Sample](#TOC1) Programs [Test](#TOC2) Programs
<div id="werror-test">
#### werror-test
```
Usage: werror-test
```
Simple tests for the wide-string error class WError
[Sample](#TOC1) Programs [Test](#TOC2) Programs
<div id="write-test">
#### write-test
```
Usage: write-test file case
where case is an integer between 1 and 11
```
ExifData write unit tests
[Sample](#TOC1) Programs [Test](#TOC2) Programs
<div id="write2-test">
#### write2-test
```
Usage: write2-test file
```
ExifData write unit tests for Exif data created from scratch
[Sample](#TOC1) Programs [Test](#TOC2) Programs
<div id="xmpdump">
#### xmpdump
```
Usage: xmpdump file
```
Sample program to dump the XMP packet of an image
[Sample](#TOC1) Programs [Test](#TOC2) Programs
<div id="xmpparser-test">
#### xmpparser-test
```
Usage: xmpparser-test file
```
Read an XMP packet from a file, parse and re-serialize it.
[Sample](#TOC1) Programs [Test](#TOC2) Programs
Robin Mills<br>
robin@clanmills.com<br>
Revised: 2019-06-20

@ -123,9 +123,5 @@ foreach(application ${APPLICATIONS})
endif()
endforeach()
# ******************************************************************************
# Man page
install( FILES exiv2samples.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1 )
# That's all Folks!
##

@ -1,662 +0,0 @@
.\" Hey, EMACS: -*- nroff -*-
.\" First parameter, NAME, should be all caps
.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
.\" other parameters are allowed: see man(7), man(1)
.TH EXIV2SAMPLES 1 "Dec 29, 2015"
.\" Please adjust this date whenever revising the manpage.
.\"
.\" Some roff macros, for reference:
.\" .nh disable hyphenation
.\" .hy enable hyphenation
.\" .ad l left justify
.\" .ad b justify to both left and right margins
.\" .nf disable filling
.\" .fi enable filling
.\" .br insert line break
.\" .sp <n> insert n+1 empty lines
.\" for manpage-specific macros, see man(7)
.SH NAME
exiv2 sample applications\- Image metadata manipulation tool
.SH SYNOPSIS
.B exiv2
[\fIoptions\fP] [\fIaction\fP] \fIfile\fP ...
.br
.SH DESCRIPTION
.PP
.\" TeX users may be more comfortable with the \fB<whatever>\fP and
.\" \fI<whatever>\fP escape sequences to invode bold face and italics,
.\" respectively.
.B exiv2
is a program to read and write Exif, IPTC, XMP metadata and
image comments and can read many vendor makernote tags. Users
who build exiv2 and its library also build some sample and test applications.
.br
The samples are:
.br
.nf
exiv2json Format metadata in json
exifprint Print the metadata in one or more images
.fi
.br
The following image formats are supported:
.TS
lB lB lB lB lB
_ _ _ _ _
l l l l l.
Type Exif IPTC XMP Image comments
JPEG Read/Write Read/Write Read/Write Read/Write
EXV Read/Write Read/Write Read/Write Read/Write
CR2 Read/Write Read/Write Read/Write -
CRW Read/Write - - Read/Write
MRW Read Read Read -
TIFF Read/Write Read/Write Read/Write -
DNG Read/Write Read/Write Read/Write -
NEF Read/Write Read/Write Read/Write -
PEF Read/Write Read/Write Read/Write -
ARW Read Read Read -
RW2 Read Read Read -
SR2 Read Read Read -
SRW Read/Write Read/Write Read/Write -
ORF Read/Write Read/Write Read/Write -
PNG Read/Write Read/Write Read/Write Read/Write
PGF Read/Write Read/Write Read/Write Read/Write
RAF Read Read Read -
EPS - - Read/Write -
XMP - - Read/Write -
GIF - - - -
PSD Read/Write Read/Write Read/Write -
TGA - - - -
BMP - - - -
JP2 Read/Write Read/Write Read/Write -
.TE
.IP \(bu 2
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.
.IP \(bu 2
Reading other TIFF-like RAW image formats, which are not listed in the
table, may also work.
.SH ACTIONS
The \fIaction\fP argument is only required if it is not clear from the
\fIoptions\fP which action is implied.
.TP
.B pr | print
Print image metadata. This is the default action, i.e., the command
\fIexiv2 image.jpg\fP will print a summary of the image Exif metadata.
.TP
.B ex | extract
Extract metadata to *.exv, XMP sidecar (*.xmp) and thumbnail image files.
Modification commands can be applied on-the-fly.
.TP
.B in | insert
Insert metadata from corresponding *.exv, XMP sidecar (*.xmp) and
thumbnail files. Use option \fB\-S\fP \fI.suf\fP to change the suffix
of the input files. 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. Modification commands can be applied
on-the-fly.
.TP
.B rm | delete
Delete image metadata from the files.
.TP
.B ad | adjust
Adjust Exif timestamps by the given time. Requires at least one of the
options \fB\-a\fP \fItime\fP, \fB\-Y\fP \fIyrs\fP, \fB\-O\fP
\fImon\fP or \fB\-D\fP \fIday\fP.
.TP
.B mo | modify
Apply commands to modify (add, set, delete) the Exif, IPTC and XMP
metadata of image files. Requires option \fB\-c\fP, \fB\-m\fP or
\fB\-M\fP.
.TP
.B mv | rename
Rename files and/or set file timestamps according to the Exif create
timestamp. Uses the value of tag Exif.Photo.DateTimeOriginal or, if
not present, Exif.Image.DateTime to determine the timestamp. The
filename format can be set with \fB\-r\fP \fIfmt\fP, timestamp options
are \fB\-t\fP and \fB\-T\fP.
.TP
.B fi | fixiso
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 standard
Exif ISO tag.
.TP
.B fc | fixcom
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 \fB\-n\fP to specify the current
encoding of the comment if necessary.
.br
.ne 40
.SH COMMAND SUMMARY
.sp 1
.nf
exiv2 [ opt [arg] ]+ [ act ] file ...
.sp 1
option [arg] long option description
-a tim --adjust Modify time stamps. [+|-]HH[:MM[:SS[.mmm]]]
-b --binary Show large binary values (default is to suppress them).
-c txt --comment JPEG comment string to set in the image ('modify' action). ...
-d tgt --delete Delete target(s) for the 'delete' action. ...
-D +-n --days Time adjustment by a positive or negative number of days ...
-e tgt --extract Extract target(s) for the 'extract' action.
-f --force Do not prompt before overwriting existing files ...
-F --Force Do not prompt before renaming files (Force rename) ...
-g key --grep Only output info for this Exiv2 key (grep).
-h --help Display help and exit.
-i tgt --insert Insert target(s) for the 'insert' action. ...
-k --keep Preserve file timestamps when updating files (keep)
-K Key --key Report key. Similar to -g (grep) however key must match exactly.
-l dir --location Location (directory) for files to be inserted or extracted.
-m file --modify read commands from cmd-file
-M cmd --Modify Command line for the 'modify' action. ...
-n enc --encode Charset to decode Exif Unicode user comments. See: man 3 iconv_open
-O +-n --months Time adjustment by a positive or negative number of months, ...
-p mod --print Print report (common reports)
-P flg --Print Print report (fine grained control)
-q --quiet Silence warnings and error messages from the Exiv2 library ...
-Q lvl --log Set the log-level to 'd'(ebug), 'i'(nfo), 'w'(arning), 'e'(rror)
-r fmt --rename Filename format for the 'rename' action. ...
-S suf --suffix Use suffix .suf for source files for insert command.
-t --timestamp Set the file timestamp according to the Exif create timestamp ...
-T --Timestamp Only set the file timestamp according to Exif create timestamp ...
-u --unknown Show unknown tags ...
-v --verbose verbose
-V --version Show the program version and exit.
-Y +-n --years Time adjustment by a positive or negative number of years ...
.sp 1
act pr | ex | in | rm | ad | mo | mv | fi | fc
print, extract, insert, delete, adjust, modify, rename, fixiso,fixcom
cmd See "Commands" below.
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 is %Y%m%d_%H%M%S.
lvl d | i | i | w | e
debug, info, warning, error
mod s | a | t | v | h | i | x | c | p | i | S | X :
summary, add, translated, vanilla, hex ...
iptc ,xmp, comment, preview, Structure,XMP raw
tgt a | c | e | i | t | x
all, comment, exif, iptc, thumb, xmp
.br
.fi
.ne 40
.SH OPTIONS
.TP
.B \-h
Display help and exit.
.TP
.B \-V
Show the program version and exit.
.br
When \fB\-V\fP is combined with \fB\-v\fP (Verbose version), 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), MacOSX and Linux and is provided
for test and debugging.
.TP
.B \-v
Be verbose during the program run.
.TP
.B \-q
Silence warnings and error messages from the Exiv2 library during the
program run (quiet). Note that options \fB\-v\fP and \fB\-q\fP can be
used at the same time.
.TP
.B \-Q \fIlvl\fP
Set the log-level to 'd'(ebug), 'i'(nfo), 'w'(arning), 'e'(rror)
or 'm'(ute). The default log-level is 'w'. \fB\-Qm\fP is equivalent
to \fB\-q\fP. All log messages are written to standard error.
.TP
.B \-b
Show large binary values (default is to suppress them).
.TP
.B \-u
Show unknown tags (default is to suppress tags which don't have a name).
.TP
.B \-g \fIkey\fP
Only keys which match the given key (grep).
.br
Multiple \fB\-g\fP options
can be used to grep info for several keys. When the library is build with C++11,
keys are matched using std::regex::extended. When build without C++11, keys are
processed with the system regular expression engine: see man 3 regex. Platforms which do not support
regex use key for a substring match. You can determine the availability of regex
using the command: exiv2 -v -V -g have_regex -g cplusplus.
.nf
exiv2 \-g Date \-pt R.jpg
Exif.Image.DateTime Ascii 20 2012:08:07 16:01:05
Exif.Photo.DateTimeOriginal Ascii 20 2011:09:18 16:25:48
Exif.Photo.DateTimeDigitized Ascii 20 2011:09:18 16:25:48
.fi
-g (--grep) is only applied to keys. It is not generally applied to all output such as the default -ps report.
The key may finish with the optional modifier /i to indicated case insensitive.
.TP
.B \-K \fIkey\fP
Only report data for given key.
.br
Multiple \fB\-K\fP options can be used to report more than a single key.
.nf
exiv2 \-K Exif.Photo.DateTimeDigitized -K Exif.Photo.DateTimeOriginal \-pt R.jpg
Exif.Photo.DateTimeOriginal Ascii 20 2011:09:18 16:25:48
Exif.Photo.DateTimeDigitized Ascii 20 2011:09:18 16:25:48
.fi
.TP
.B \-n \fIenc\fP
Charset to use to decode Exif Unicode user comments. \fIenc\fP is
a name understood by \fBiconv_open\fP(3), e.g., 'UTF-8'.
.TP
.B \-k
Preserve file timestamps when updating files (keep). Can be used with
all options which update files. The flag is ignored by read-only
options.
.TP
.B \-t
Set the file timestamp according to the Exif create timestamp in
addition to renaming the file (overrides \fB\-k\fP). This option is
only used with the 'rename' action.
.TP
.B \-T
Only set the file timestamp according to the Exif create timestamp, do
not rename the file (overrides \fB\-k\fP). This option is only used
with the 'rename' action. Note: On Windows you may have to set the TZ
environment variable for this option to work correctly.
.TP
.B \-f
Do not prompt before overwriting existing files (force overwrite).
.TP
.B \-F
Do not prompt before renaming files (Force rename). Appends '_1'
('_2', ...) to the name of the new file.
.TP
.B \-a \fItime\fP
Time adjustment in the format [\-]HH[:MM[:SS]]. This option is only
used with the 'adjust' action. Examples: 1 adds one hour, 1:01
adds one hour and one minute, \-0:00:30 subtracts 30 seconds.
.TP
.B \-Y \fIyrs\fP
Time adjustment by a positive or negative number of years, for
the 'adjust' action.
.TP
.B \-O \fImon\fP
Time adjustment by a positive or negative number of months, for
the 'adjust' action.
.TP
.B \-D \fIday\fP
Time adjustment by a positive or negative number of days, for
the 'adjust' action.
.TP
.B \-p \fImode\fP
Print mode for the 'print' action. Possible modes are:
.br
s : print a summary of the Exif metadata (the default)
.br
a : print Exif, IPTC and XMP metadata (shortcut for \-Pkyct)
.br
t : interpreted (translated) Exif tags (\-PEkyct)
.br
v : plain Exif tag values (\-PExgnycv)
.br
h : hexdump of the Exif data (\-PExgnycsh)
.br
i : IPTC datasets (\-PIkyct)
.br
x : XMP properties (\-PXkyct)
.br
c : JPEG comment
.br
p : list available image previews, sorted by preview image size in pixels
.br
S : print image structure information (jpg, png and tiff only)
.br
X : print "raw" XMP (jpg, png and tiff only)
.TP
.B \-P \fIflgs\fP
Print flags for fine control of the tag list ('print' action). Allows
control of the type of metadata as well as data columns included in
the print output. Valid flags are:
.br
E : include Exif tags in the list
.br
I : IPTC datasets
.br
X : XMP properties
.br
x : print a column with the tag number
.br
g : group name
.br
k : key
.br
l : tag label
.br
n : tag name
.br
y : type
.br
c : number of components (count)
.br
s : size in bytes
.br
v : plain data value
.br
V : plain data value AND the word 'set ' at the start of line (for use with exiv2 -m-)
.br
t : interpreted (translated) data
.br
h : hexdump of the data
.TP
.B \-d \fItgt\fP
Delete target(s) for the 'delete' action. Possible targets are:
.br
a : all supported metadata (the default)
.br
e : Exif section
.br
t : Exif thumbnail only
.br
i : IPTC data
.br
x : XMP packet
.br
c : JPEG comment
.TP
.B \-i \fItgt\fP
Insert target(s) for the 'insert' action. Possible targets are the
same as those for the \fB\-d\fP option, plus an optional modifier:
.sp 1
X : Insert metadata from an XMP sidecar file <file>.xmp. The remaining
insert targets determine what metadata to insert from the sidecar
file. Possible are Exif, IPTC and XMP and the default is all of
these. Note that the inserted XMP properties include those converted
to Exif and IPTC.
.br
This is option is intended for "filter" operations on the XMP such as:
.br
$ exiv2 -e{tgt}- \fIfilename\fP | xmllint .... | exiv2 -i{tgt}- \fIfilename\fP
.sp 1
Only JPEG thumbnails can be inserted (not TIFF thumbnails), they need to
be named \fIfile\fP\-thumb.jpg.
.TP
.B \-e \fItgt\fP
Extract target(s) for the 'extract' action. Possible targets are the same
as those for the \fB\-d\fP option, plus a target to extract preview
images and a modifier to generate an XMP sidecar file:
.br
p[<n>[,<m> ...]] : Extract preview images. The optional comma separated
list of preview image numbers is used to determine which preview images
to extract. The available preview images and their numbers are displayed
with the 'print' option \fB\-pp\fP.
.sp 1
X : Extract metadata to an XMP sidecar file <file>.xmp. The remaining
extract targets determine what metadata to extract to the sidecar
file. Possible are Exif, IPTC and XMP and the default is all of these.
.sp 1
- : Output sidecar file to stdout (see -i tgt for example)
.sp 1
.TP
.B \-r \fIfmt\fP
Filename format for the 'rename' action. The format string follows
\fBstrftime\fP(3) and supports the following keywords:
.br
:basename: - original filename without extension
.br
:dirname: - name of the directory holding the original file
.br
:parentname: - name of parent directory
.br
Default filename format is %Y%m%d_%H%M%S.
.TP
.B \-c \fItxt\fP
JPEG comment string to set in the image ('modify' action). This option
can also be used with the 'extract' and 'insert' actions to modify
metadata on-the-fly. -m- represents standard-input.
.TP
.B \-m \fIfile\fP
Command file for the 'modify' action. This option can also be used
with the 'extract' and 'insert' actions to modify metadata on-the-fly.
.TP
.B \-M \fIcmd\fP
Command line for the 'modify' action. This option can also be used
with the 'extract' and 'insert' actions to modify metadata on-the-fly.
The format for the commands is the same as that of the lines of a
command file.
.TP
.B \-l \fIdir\fP
Location (directory) for files to be inserted or extracted.
.TP
.B \-S \fI.suf\fP
Use suffix \fI.suf\fP for source files in 'insert' action.
.SH COMMANDS
Commands for the 'modify' action can be read from a command file, e.g.,
.sp 1
.nf
exiv2 \-m cmd.txt image.jpg
.fi
.sp 1
or given on the command line, as in
.sp 1
.nf
exiv2 \-M"add Iptc.Application2.Credit String Mr. Smith" image.jpg
.fi
.sp 1
Note the quotes. Multiple \fB\-m\fP and \fB\-M\fP options can be combined,
and a non-standard XMP namespace registered.
.sp 1
.nf
exiv2 \-M"reg myprefix http://ns.myprefix.me/" \-M"add Xmp.myprefix.Whom Mr. Smith" \-M"set Exif.Image.Artist Mr. Smith" image.jpg
.fi
.sp 1
When writing Exif, IPTC and XMP metadata,
.B exiv2
enforces only a correct
metadata structure. It is possible to write tags with types and values
different from those specified in the standards, duplicate Exif tags,
undefined tags, or incomplete metadata. While
.B exiv2
is able to read
all metadata that it can write, other programs may have difficulties
with images that contain non standard-conforming metadata.
.SS Command format
The format of a command is
.sp 1
.nf
\fBset | add | del\fP \fIkey\fP [[\fItype\fP] \fIvalue\fP]
.fi
.TP
.B set
Set the \fIvalue\fP of an existing tag with a matching \fIkey\fP or
add the tag.
.TP
.B add
Add a tag (unless \fIkey\fP is a non\-repeatable IPTC key; nothing
prevents you from adding duplicate Exif tags).
.TP
.B del
Delete all occurrences of a tag (requires only a \fIkey\fP).
.TP
.I key
Exiv2 Exif, IPTC or XMP key.
.TP
.I type
.B Byte | Ascii | Short | Long | Rational | Undefined | SShort | SLong | SRational | Comment
for Exif keys,
.br
.B String | Date | Time | Short | Undefined
for IPTC keys, and
.br
.B XmpText | XmpAlt | XmpBag | XmpSeq | LangAlt
for XMP keys.
.sp 1
A default \fItype\fP is used if none is explicitly given. The default
is determined based on \fIkey\fP.
.TP
.I value
The remaining text on the line is the value. It can optionally be
enclosed in single quotes ('\fIvalue\fP') or double quotes ("\fIvalue\fP").
.sp 1
The value is optional. Not providing any value is equivalent to an
empty value ("") and is mainly useful to create an XMP array property,
e.g., a bag.
.sp 1
The format of Exif \fBComment\fP values includes an optional charset
specification at the beginning:
.br
.B [charset=Ascii|Jis|Unicode|Undefined ]\fIcomment\fP
.sp 1
.B Undefined
is used by default if the value doesn't start with a charset
definition.
.sp 1
The format for an IPTC \fBDate\fP value is:
.br
YYYY\-MM\-DD (year, month, day)
.sp 1
The format for an IPTC \fBTime\fP value is:
.br
HH:MM:SS (hours, minutes, seconds)
.br
and may optionally be followed by:
.br
\-HH:MM or +HH:MM (hours, minutes ahead/behind UTC)
.sp 1
The format of \fBRational\fP (and \fBSRational\fP) is one of:
.br
integer
.br
integer-numerator/integer-denominator
.br
Fnumber
.br
fnumber
.sp 1
Rational Examples:
.br
exiv2 "-Mset Exif.Photo.MaxApertureValue 557429/62500" X.jpg
.br
exiv2 "-Mset Exif.Photo.MaxApertureValue F5.6" X.jpg
.sp 1
The Rational format Fnumber (or fnumber) is for the convenience of setting aperture values. Aperture values
are stored in Exif is an \fBAPEX\fP value which can be evaluated by the expression:
.sp 1
apex-value = log(Fnumber) * 2.0 / log(2.0)
.br
Fnumber = exp(apex-value * log(2.0) / 2.0)
.sp 1
The Rational format Fnumber is valid for any \fBRational\fP, even when the key is not an Aperture.
More information about \fBAPEX\fP value is available from: http://en.wikipedia.org/wiki/APEX_system
.sp 1
The format of XMP \fBLangAlt\fP values includes an optional language qualifier:
.br
.B lang="\fIlanguage-code\fP\fI" text\fP
.sp
lang="x-default" is used if the value doesn't start with a language qualifier.
.sp 1
exiv2 -M'set Xmp.dc.title lang="de-DE" Euros' X.jpg
.br
exiv2 -M'set Xmp.dc.title lang="en-GB" Pounds' X.jpg
.br
exiv2 -M'set Xmp.dc.title lang="en-US" In God We Trust' X.jpg
.br
exiv2 -M'set Xmp.dc.title All others pay cash' X.jpg
.sp 1
To remove a language specification, set the value to '' (empty string)
.br
exiv2 -M'set Xmp.dc.title lang="en-US"' X.jpg
.sp 1
To remove all language specifications, delete the key:
.br
exiv2 -M'del Xmp.dc.title' X.jpg
.TP
To register additional XMP namespaces, combine the command with:
.TP
.nf
\fBreg\fP \fIprefix\fP \fInamespace\fP
.fi
.SS Command file format
Empty lines and lines starting with \fB#\fP in a command file are
ignored (comments). Remaining lines are commands as described above.
.SH EXAMPLES
.TP
exiv2 *.jpg
Prints a summary of the Exif information for all JPEG files in the directory.
.TP
exiv2 \-pi image.jpg
Prints the IPTC metadata of the image.
.TP
exiv2 rename img_1234.jpg
Renames img_1234.jpg (taken on 13\-Nov\-05 at 22:58:31) to 20051113_225831.jpg
.TP
exiv2 \-r':basename:_%Y%m' rename img_1234.jpg
Renames img_1234.jpg to img_1234_200511.jpg
.TP
exiv2 \-et img1.jpg img2.jpg
Extracts the Exif thumbnails from the two files into img1\-thumb.jpg
and img2\-thumb.jpg.
.TP
exiv2 \-it img1.jpg img2.jpg
Inserts (copies) metadata from img1.exv to img1.jpg and from img2.exv
to img2.jpg.
.TP
exiv2 \-ep1,2 image.jpg
Extracts previews 1 and 2 from the image to the files image\-preview1.jpg
and image\-preview2.jpg.
.TP
exiv2 \-eiX image.jpg
Extracts IPTC datasets into an XMP sidecar file image.xmp and in the
process converts them to "IPTC Core" XMP schema.
.TP
exiv2 \-iixX image.jpg
Inserts IPTC and XMP metadata from an XMP sidecar file image.xmp into
image.jpg. The resulting IPTC datasets are converted from the "IPTC
Core" XMP schema properties in the sidecar file to the older IPTC IIM4
format. The inserted XMP properties include those in the "IPTC Core"
XMP schema.
.TP
.nf
exiv2 \-M"set Exif.Photo.UserComment charset=Ascii New Exif comment" image.jpg
.fi
Sets the Exif comment to an ASCII string.
.TP
.nf
exiv2 \-M"set Exif.GPSInfo.GPSLatitude 4/1 15/1 33/1" \\
\-M"set Exif.GPSInfo.GPSLatitudeRef N" image.jpg
.fi
Sets the latitude to 4 degrees, 15 minutes and 33 seconds north. The
Exif standard stipulates that the GPSLatitude tag consists of three
Rational numbers for the degrees, minutes and seconds of the latitude
and GPSLatitudeRef contains either 'N' or 'S' for north or south
latitude respectively.
.TP
.nf
exiv2 insert \-l/tmp -S.CRW /data/*.JPG
.fi
Copy all metadata from CRW files in the /tmp directory to JPG files
with corresponding basenames in the /data directory. Note that this
copies metadata as is, without any modifications to adapt it to the
requirements of the target format. Some tags copied like this may not
make sense in the target image.
.SH SEE ALSO
.TP
.I http://www.exiv2.org/sample.html#modify
Sample command files.
.TP
.I http://www.exiv2.org/metadata.html
Taglists with \fIkey\fP and default \fItype\fP values.
.SH AUTHORS
.B exiv2
was written by Andreas Huggel and others. The Exiv2 project web site is http://exiv2.org
.PP
This manual page was originally created for the Debian project by KELEMEN Peter <fuji@debian.org>.

@ -138,14 +138,46 @@
Sample program showing how to set the Exif comment of an image.
*/
/*!
@example iptcprint.cpp
Sample program to print the IPTC metadata of an image
@example exifdata.cpp
Prints Exif metadata in different formats in an image.
*/
/*!
@example exifvalue.cpp
Prints the value of a single Exif tag in a file
*/
/*!
@example exiv2json.cpp
Extracts data from image in JSON format.
*/
/*!
@example geotag.cpp
Reads GPX data and updates images with GPS Tags
*/
/*!
@example iptceasy.cpp
The quickest way to access, set or modify IPTC metadata
*/
/*!
@example iptcprint.cpp
Demonstrates Exiv2 library APIs to print Iptc data
*/
/*!
@example metacopy.cpp
Demonstrates copying metadata from one image to another
*/
/*!
@example mrwthumb.cpp
Sample program to extract a Minolta thumbnail from the makernote
*/
/*!
@example xmpsample.cpp
Sample usage of high-level XMP classes.
*/
/*!
@example xmpparse.cpp
Read an XMP packet from a file, parse it and print all (known) properties.
*/
/*!
@example xmpprint.cpp
Read an XMP from a file, parse it and print all (known) properties
*/

Loading…
Cancel
Save