The Exiv2 C++ library is made up of all elements defined in the Exiv2 namespace.
The top-level class of the Exiv2 library is Exiv2::Image. Exiv2::Image defines the interface to access image metadata. Derived from Exiv2::Image are implementations for different image formats. Most importantly, they contain the logic to read metadata from the image into Exiv2 metadata containers and write it back to the image. Most applications will use Exiv2::ImageFactory to access images in files or memory, in which case the image format is transparent to them. The factory determines the image format from the data (not the file extension) and creates an object of the corresponding Image subclass.
Exif and IPTC metadata is manipulated through the classes
They hold a container of Exif and IPTC metadata, respectively, and define
related methods to access and manipulate the metadata.
Exif tag and IPTC dataset reference information for the standard tags and datasets is available in the two static classes Exiv2::ExifTags and Exiv2::IptcDataSets.
The metadata containers hold objects derived from Exiv2::Metadatum. Interface class Exiv2::Metadatum defines methods to access the information of one metadatum. It models the tag data as a key and value pair. The abstract base class Exiv2::Key defines the interface for a key. Concrete keys implement Exif and IPTC keys. The abstract base class Exiv2::Value defines the interface to access tag information, from which concrete values are derived. The actual value used in a metadatum depends on the type of the Exif tag or IPTC dataset. It is usually determined when the Exif or IPTC metadata is read from an image. It is also possible to manually create a Value and together with a key add it to an ExifData or IptcData container.
There are several simple examples that demonstrate the basic use of Exiv2
shows how the Exif data of an image can be read and written to the screen.
Iptcprint is a similar
example to print IPTC data.
Addmoddel shows how to
add, modify and delete Exif metadata.
Exifcomment shows how to
set the exif comment of an image.
Xmpsample.cpp contains examples
of how to set various types of XMP properties.
For more real-world code have a look at the implementation of the different actions of the Exiv2 utility (actions.cpp).
Exif Makernote data can be accessed through ExifData in the same way as the standard Exif tags. In other words, for each entry of a known Makernote, there is a corresponding Metadatum in the ExifData container. Makernote taglists are internally kept in classes Exiv2::Internal::<Make>MakerNote (e.g., Exiv2::Internal::CanonMakerNote.)