# Exiv2::Image Class Reference

Abstract base class defining the interface for an image. This is the top-level interface to the Exiv2 library. More...

`#include <image.hpp>`

Inheritance diagram for Exiv2::Image:

[legend]
List of all members.

## Public Types

typedef std::auto_ptr< Image > | AutoPtr
| Image auto_ptr type.

## Public Member Functions

Creators
virtual | ~Image ()
| Virtual Destructor.
Manipulators
virtual void | readMetadata ()=0
| Read all metadata supported by a specific image format from the image. Before this method is called, the various metadata types will be empty.
virtual void | writeMetadata ()=0
| Write metadata back to the image.
virtual void | setExifData (const ExifData &exifData)=0
| Assign new exif data. The new exif data is not written to the image until the writeMetadata() method is called.
virtual void | clearExifData ()=0
| Erase any buffered Exif data. Exif data is not removed from the actual image until the writeMetadata() method is called.
virtual void | setIptcData (const IptcData &iptcData)=0
| Assign new iptc data. The new iptc data is not written to the image until the writeMetadata() method is called.
virtual void | clearIptcData ()=0
| Erase any buffered Iptc data. Iptc data is not removed from the actual image until the writeMetadata() method is called.
virtual void | setComment (const std::string &comment)=0
| Set the image comment. The new comment is not written to the image until the writeMetadata() method is called.
virtual void | clearComment ()=0
| Erase any buffered comment. Comment is not removed from the actual image until the writeMetadata() method is called.
virtual void | setMetadata (const Image &image)=0
| Copy all existing metadata from source Image. The data is copied into internal buffers and is not written to the image until the writeMetadata() method is called.
virtual void | clearMetadata ()=0
| Erase all buffered metadata. Metadata is not removed from the actual image until the writeMetadata() method is called.
Accessors
virtual bool | good () const =0
| Check if the Image instance is valid. Use after object construction.
virtual const ExifData & | exifData () const =0
| Returns an ExifData instance containing currently buffered Exif data.
virtual ExifData & | exifData ()=0
| Returns an ExifData instance containing currently buffered Exif data.
virtual const IptcData & | iptcData () const =0
| Returns an IptcData instance containing currently buffered Iptc data.
virtual IptcData & | iptcData ()=0
| Returns an IptcData instance containing currently buffered Iptc data.
virtual std::string | comment () const =0
| Return a copy of the image comment. May be an empty string.
virtual BasicIo & | io () const =0
| Return a reference to the BasicIo instance being used for Io.
bool | supportsMetadata (MetadataId metadataId) const
| Check if image supports a particular type of metadata.

## Protected Member Functions

Creators
| Image (uint16_t supportedMetadata)
| Constructor taking a bitmap of the metadata types, which are supported.

## Detailed Description

Abstract base class defining the interface for an image. This is the top-level interface to the Exiv2 library.

Most client apps will obtain an Image instance by calling a static ImageFactory method. The Image class can then be used to to read, write, and save metadata.

## Member Function Documentation

virtual ExifData& Exiv2::Image::exifData | ( |  | ) | `[pure virtual]`

Returns an ExifData instance containing currently buffered Exif data.

The contained Exif data may have been read from the image by a previous call to readMetadata() or added directly. The Exif data in the returned instance will be written to the image when writeMetadata() is called.

Returns:
  modifiable ExifData instance containing Exif values

Implemented in Exiv2::CrwImage, Exiv2::JpegBase, Exiv2::MrwImage, and Exiv2::TiffImage.

virtual const ExifData& Exiv2::Image::exifData | ( |  | ) | const`[pure virtual]`

Returns an ExifData instance containing currently buffered Exif data.

The Exif data may have been read from the image by a previous call to readMetadata() or added directly. The Exif data in the returned instance will be written to the image when writeMetadata() is called.

Returns:
  read only ExifData instance containing Exif values

Implemented in Exiv2::CrwImage, Exiv2::JpegBase, Exiv2::MrwImage, and Exiv2::TiffImage.

virtual bool Exiv2::Image::good | ( |  | ) | const`[pure virtual]`

Check if the Image instance is valid. Use after object construction.

Returns:
  true if the Image is in a valid state.

Implemented in Exiv2::CrwImage, Exiv2::JpegBase, Exiv2::MrwImage, and Exiv2::TiffImage.

virtual BasicIo& Exiv2::Image::io | ( |  | ) | const`[pure virtual]`

Return a reference to the BasicIo instance being used for Io.

This refence is particularly useful to reading the results of operations on a MemIo instance. For example after metadata has been modified and the writeMetadata() method has been called, this method can be used to get access to the modified image.

Returns:
  BasicIo instance that can be used to read or write image data directly.

Note:
  If the returned BasicIo is used to write to the image, the Image class will not see those changes until the readMetadata() method is called.

Implemented in Exiv2::CrwImage, Exiv2::JpegBase, Exiv2::MrwImage, and Exiv2::TiffImage.

virtual IptcData& Exiv2::Image::iptcData | ( |  | ) | `[pure virtual]`

Returns an IptcData instance containing currently buffered Iptc data.

The contained Iptc data may have been read from the image by a previous call to readMetadata() or added directly. The Iptc data in the returned instance will be written to the image when writeMetadata() is called.

Returns:
  modifiable IptcData instance containing Iptc values

Implemented in Exiv2::CrwImage, Exiv2::JpegBase, Exiv2::MrwImage, and Exiv2::TiffImage.

virtual const IptcData& Exiv2::Image::iptcData | ( |  | ) | const`[pure virtual]`

Returns an IptcData instance containing currently buffered Iptc data.

The contained Iptc data may have been read from the image by a previous call to readMetadata() or added directly. The Iptc data in the returned instance will be written to the image when writeMetadata() is called.

Returns:
  modifiable IptcData instance containing Iptc values

Implemented in Exiv2::CrwImage, Exiv2::JpegBase, Exiv2::MrwImage, and Exiv2::TiffImage.

virtual void Exiv2::Image::readMetadata | ( |  | ) | `[pure virtual]`

Read all metadata supported by a specific image format from the image. Before this method is called, the various metadata types will be empty.

This method returns success even if no metadata is found in the image. Callers must therefore check the size of individual metadata types before accessing the data.

Exceptions:

  | Error | if opening or reading of the file fails or the image data is not valid (does not look like data of the specific image type).

Implemented in Exiv2::CrwImage, Exiv2::JpegBase, Exiv2::MrwImage, and Exiv2::TiffImage.

virtual void Exiv2::Image::setComment | ( | const std::string & | comment | ) | `[pure virtual]`

Set the image comment. The new comment is not written to the image until the writeMetadata() method is called.

Parameters:

  | comment | String containing comment.

Implemented in Exiv2::CrwImage, Exiv2::JpegBase, Exiv2::MrwImage, and Exiv2::TiffImage.

virtual void Exiv2::Image::setExifData | ( | const ExifData & | exifData | ) | `[pure virtual]`

Assign new exif data. The new exif data is not written to the image until the writeMetadata() method is called.

Parameters:

  | exifData | An ExifData instance holding exif data to be copied

Implemented in Exiv2::CrwImage, Exiv2::JpegBase, Exiv2::MrwImage, and Exiv2::TiffImage.

virtual void Exiv2::Image::setIptcData | ( | const IptcData & | iptcData | ) | `[pure virtual]`

Assign new iptc data. The new iptc data is not written to the image until the writeMetadata() method is called.

Parameters:

  | iptcData | An IptcData instance holding iptc data to be copied

Implemented in Exiv2::CrwImage, Exiv2::JpegBase, Exiv2::MrwImage, and Exiv2::TiffImage.

virtual void Exiv2::Image::setMetadata | ( | const Image & | image | ) | `[pure virtual]`

Copy all existing metadata from source Image. The data is copied into internal buffers and is not written to the image until the writeMetadata() method is called.

Parameters:

  | image | Metadata source. All metadata types are copied.

Implemented in Exiv2::CrwImage, Exiv2::JpegBase, Exiv2::MrwImage, and Exiv2::TiffImage.

virtual void Exiv2::Image::writeMetadata | ( |  | ) | `[pure virtual]`

Write metadata back to the image.

All existing metadata sections in the image are either created, replaced, or erased. If values for a given metadata type have been assigned, a section for that metadata type will either be created or replaced. If no values have been assigned to a given metadata type, any exists section for that metadata type will be removed from the image.

Exceptions:

  | Error | if the operation fails

Implemented in Exiv2::CrwImage, Exiv2::JpegBase, Exiv2::MrwImage, and Exiv2::TiffImage.

The documentation for this class was generated from the following files:

- image.hpp
- image.cpp