|
Packit |
01d647 |
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
The Exiv2 library is made up of all
|
|
Packit |
01d647 |
elements defined in the Exiv2
|
|
Packit |
01d647 |
namespace.
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
The top-level class of the Exiv2 library is
|
|
Packit |
01d647 |
href="classExiv2_1_1Image.html">Exiv2::Image. Exiv2::Image
|
|
Packit |
01d647 |
defines the interface to access image metadata. Derived from
|
|
Packit |
01d647 |
Exiv2::Image are implementations for different image formats. Most
|
|
Packit |
01d647 |
importantly, they contain the logic to read metadata from the image
|
|
Packit |
01d647 |
into Exiv2 metadata containers and write it back to the image.
|
|
Packit |
01d647 |
Most applications will use
|
|
Packit |
01d647 |
Exiv2::ImageFactory
|
|
Packit |
01d647 |
to access images in files or memory, in which case the image format
|
|
Packit |
01d647 |
is transparent to them. The factory determines the image format from the
|
|
Packit |
01d647 |
data (not the file extension) and creates an object of the corresponding
|
|
Packit |
01d647 |
Image subclass.
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
Exif and IPTC metadata is manipulated through the classes
|
|
Packit |
01d647 |
Exiv2::ExifData
|
|
Packit |
01d647 |
and Exiv2::IptcData.
|
|
Packit |
01d647 |
They hold a container of Exif and IPTC metadata, respectively, and define
|
|
Packit |
01d647 |
related methods to access and manipulate the metadata.
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
Exif tag and IPTC dataset reference information for the standard tags
|
|
Packit |
01d647 |
and datasets is available in the two static classes
|
|
Packit |
01d647 |
Exiv2::ExifTags and
|
|
Packit |
01d647 |
Exiv2::IptcDataSets.
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
The metadata containers hold objects derived from
|
|
Packit |
01d647 |
Exiv2::Metadatum.
|
|
Packit |
01d647 |
Interface class Exiv2::Metadatum defines methods to access the
|
|
Packit |
01d647 |
information of one metadatum. It models the tag data as a key and
|
|
Packit |
01d647 |
value pair.
|
|
Packit |
01d647 |
The abstract base class
|
|
Packit |
01d647 |
Exiv2::Key defines the
|
|
Packit |
01d647 |
interface for a key. Concrete keys implement Exif and IPTC keys.
|
|
Packit |
01d647 |
The abstract base class
|
|
Packit |
01d647 |
Exiv2::Value defines
|
|
Packit |
01d647 |
the interface to access tag information, from which concrete values are
|
|
Packit |
01d647 |
derived. The actual value used in a metadatum depends on the type of
|
|
Packit |
01d647 |
the Exif tag or IPTC dataset. It is usually determined when the Exif or
|
|
Packit |
01d647 |
IPTC metadata is read from an image. It is also possible to manually create
|
|
Packit |
01d647 |
a Value and together with a key add it to an ExifData or IptcData
|
|
Packit |
01d647 |
container.
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
The classes to access XMP metadata are
|
|
Packit |
01d647 |
Exiv2::XmpData,
|
|
Packit |
01d647 |
Exiv2::Xmpdatum
|
|
Packit |
01d647 |
and Exiv2::XmpKey.
|
|
Packit |
01d647 |
They work similar to the corresponding Exif and IPTC classes.
|
|
Packit |
01d647 |
The property reference information is in
|
|
Packit |
01d647 |
Exiv2::XmpProperties.
|
|
Packit |
01d647 |
In addition to the expected new members, class
|
|
Packit |
01d647 |
Exiv2::Image
|
|
Packit |
01d647 |
now also has an interface to access the raw XMP packet.
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
All XMP value types are supported: Simple types, structures,
|
|
Packit |
01d647 |
arrays, property qualifiers and language alternatives.
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
XMP properties are accessed through keys of the form
|
|
Packit |
01d647 |
"Xmp.<Prefix>.<PropertyPath>", where <Prefix> is the preferred
|
|
Packit |
01d647 |
(or rather, registered) prefix for a schema namespace and
|
|
Packit |
01d647 |
<PropertyPath> is the path of the XMP node. In its most basic
|
|
Packit |
01d647 |
form, to address simple properties, <PropertyPath> is the name
|
|
Packit |
01d647 |
of the property. In general, <PropertyPath> can be used to
|
|
Packit |
01d647 |
address any XMP node, including array items, structure fields
|
|
Packit |
01d647 |
qualifiers and deeply nested properties.
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
Any properties in known namespaces are supported and additional
|
|
Packit |
01d647 |
namespaces can be registered.
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
The specialized Exiv2 values
|
|
Packit |
01d647 |
Exiv2::XmpTextValue,
|
|
Packit |
01d647 |
Exiv2::XmpArrayValue
|
|
Packit |
01d647 |
and Exiv2::LangAltValue are
|
|
Packit |
01d647 |
provided to simplify the use of XMP properties.
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
Note: Unlike Exif and IPTC tags, XMP properties do not have
|
|
Packit |
01d647 |
a tag number.
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
There are several simple examples that demonstrate the basic use of Exiv2
|
|
Packit |
01d647 |
functionality: Exifprint
|
|
Packit |
01d647 |
shows how the Exif data of an image can be read and written to the screen.
|
|
Packit |
01d647 |
Iptcprint is a similar
|
|
Packit |
01d647 |
example to print IPTC data.
|
|
Packit |
01d647 |
Addmoddel shows how to
|
|
Packit |
01d647 |
add, modify and delete Exif metadata.
|
|
Packit |
01d647 |
Exifcomment shows how to
|
|
Packit |
01d647 |
set the exif comment of an image.
|
|
Packit |
01d647 |
Xmpsample.cpp contains examples
|
|
Packit |
01d647 |
of how to set various types of XMP properties.
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
For more real-world code have a look at the implementation of the
|
|
Packit |
01d647 |
different actions of the Exiv2 utility (actions.cpp).
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
Exif Makernote data can be accessed through ExifData in the same
|
|
Packit |
01d647 |
way as the standard Exif tags. In other words, for each entry of a
|
|
Packit |
01d647 |
known Makernote, there is a corresponding Metadatum in the ExifData
|
|
Packit |
01d647 |
container. Makernote taglists are internally kept in classes
|
|
Packit |
01d647 |
Exiv2::Internal::<Make>MakerNote (e.g.,
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
Exiv2::Internal::CanonMakerNote.)
|