# 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.
enum | Type { none, jpeg, exv }
| Supported image formats.

## Public Member Functions

Creators
virtual | ~Image ()
| Virtual Destructor.
Manipulators
virtual void | readMetadata ()=0
| Read metadata from assigned image. Before this method is called, the various metadata types (Iptc, Exif) 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 ExifData instance containing currently buffered exif 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.

## Protected Member Functions

Creators
| Image ()
| Default Constructor.

## 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::JpegBase.

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::JpegBase.

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::JpegBase.

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::JpegBase.

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

Returns an ExifData instance containing currently buffered exif 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::JpegBase.

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::JpegBase.

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

Read metadata from assigned image. Before this method is called, the various metadata types (Iptc, Exif) will be empty.

Exceptions:

  | Error | In case of failure.

Implemented in Exiv2::JpegBase.

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::JpegBase.

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::JpegBase.

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::JpegBase.

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::JpegBase.

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::JpegBase.

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

- image.hpp