| Exiv2

Loading...
Searching...
No Matches
Public Types | List of all members
Exiv2::Image Class Referenceabstract

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]

## Public Types
using | UniquePtr = std::unique_ptr<Image>
| Image auto_ptr type.

## Public Member Functions
Creators
| Image (ImageType type, uint16_t supportedMetadata, BasicIo::UniquePtr io)
| Constructor taking the image type, a bitmap of the supported metadata types and an auto-pointer that owns an IO instance. See subclass constructor doc.
virtual | ~Image ()=default
| Virtual Destructor.
Accessors
ByteOrder | byteOrder () const
| Return the byte order in which the Exif metadata of the image is encoded. Initially, it is not set (invalidByteOrder).
bool | good () const
| Check if the Image instance is valid. Use after object construction.
virtual std::string | mimeType () const =0
| Return the MIME type of the image.
virtual uint32_t | pixelWidth () const
| Return the pixel width of the image.
virtual uint32_t | pixelHeight () const
| Return the pixel height of the image.
virtual const ExifData & | exifData () const
| Returns an ExifData instance containing currently buffered Exif data.
virtual const IptcData & | iptcData () const
| Returns an IptcData instance containing currently buffered IPTC data.
virtual const XmpData & | xmpData () const
| Returns an XmpData instance containing currently buffered XMP data.
virtual std::string | comment () const
| Return a copy of the image comment. May be an empty string.
virtual const std::string & | xmpPacket () const
| Return the raw XMP packet as a string.
virtual BasicIo & | io () const
| Return a reference to the BasicIo instance being used for Io.
AccessMode | checkMode (MetadataId metadataId) const
| Returns the access mode, i.e., the metadata functions, which this image supports for the metadata type metadataId.
bool | supportsMetadata (MetadataId metadataId) const
| Check if image supports a particular type of metadata. This method is deprecated. Use checkMode() instead.
bool | writeXmpFromPacket () const
| Return the flag indicating the source when writing XMP metadata.
const NativePreviewList & | nativePreviews () const
| Return list of native previews. This is meant to be used only by the PreviewManager.
void | setTypeSupported (ImageType imageType, uint16_t supportedMetadata)
| set type support for this image format
ImageType | imageType () const
| set type support for this image format

## NOT implemented
BasicIo::UniquePtr | io_
| Image data IO pointer.
ExifData | exifData_
| Exif data container.
IptcData | iptcData_
| IPTC data container.
XmpData | xmpData_
| XMP data container.
DataBuf | iccProfile_
| ICC buffer (binary data).
std::string | comment_
| User comment.
std::string | xmpPacket_
| XMP packet.
uint32_t | pixelWidth_ {0}
| image pixel width
uint32_t | pixelHeight_ {0}
| image pixel height
NativePreviewList | nativePreviews_
| list of native previews
| Image (const Image &)=delete
| Copy constructor.
Image & | operator= (const Image &)=delete
| Assignment operator.
const std::string & | tagName (uint16_t tag)
| Return tag name for given tag id.
static const char * | typeName (uint16_t tag)
| Return tag type for given tag id.

## Manipulators
virtual void | printStructure (std::ostream &out, PrintStructureOption option=kpsNone, size_t depth=0)
| Print out the structure of image file.
virtual void | readMetadata ()=0
| Read all metadata supported by a specific image format from the image. Before this method is called, the image metadata will be cleared.
virtual void | writeMetadata ()=0
| Write metadata back to the image.
virtual void | setExifData (const ExifData &exifData)
| Assign new Exif data. The new Exif data is not written to the image until the writeMetadata() method is called.
virtual void | clearExifData ()
| 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)
| Assign new IPTC data. The new IPTC data is not written to the image until the writeMetadata() method is called.
virtual void | clearIptcData ()
| Erase any buffered IPTC data. IPTC data is not removed from the actual image until the writeMetadata() method is called.
virtual void | setXmpPacket (const std::string &xmpPacket)
| Assign a raw XMP packet. The new XMP packet is not written to the image until the writeMetadata() method is called.
virtual void | clearXmpPacket ()
| Erase the buffered XMP packet. XMP data is not removed from the actual image until the writeMetadata() method is called.
virtual void | setXmpData (const XmpData &xmpData)
| Assign new XMP data. The new XMP data is not written to the image until the writeMetadata() method is called.
virtual void | clearXmpData ()
| Erase any buffered XMP data. XMP data is not removed from the actual image until the writeMetadata() method is called.
virtual void | setComment (const std::string &comment)
| Set the image comment. The comment is written to the image when writeMetadata() is called.
virtual void | clearComment ()
| Erase any buffered comment. Comment is not removed from the actual image until the writeMetadata() method is called.
virtual void | setIccProfile (DataBuf &&iccProfile, bool bTestValid=true)
| Set the image iccProfile. The new profile is not written to the image until the writeMetadata() method is called.
void | appendIccProfile (const uint8_t *bytes, size_t size, bool bTestValid)
| Append more bytes to the iccProfile.
void | checkIccProfile ()
| Throw an exception if the size at the beginning of the iccProfile isn't correct.
virtual void | clearIccProfile ()
| Erase iccProfile. the profile is not removed from the actual image until the writeMetadata() method is called.
virtual bool | iccProfileDefined () const
| Returns the status of the ICC profile in the image instance.
virtual const DataBuf & | iccProfile () const
| return iccProfile
virtual void | setMetadata (const Image &image)
| 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 ()
| Erase all buffered metadata. Metadata is not removed from the actual image until the writeMetadata() method is called.
virtual ExifData & | exifData ()
| Returns an ExifData instance containing currently buffered Exif data.
virtual IptcData & | iptcData ()
| Returns an IptcData instance containing currently buffered IPTC data.
virtual XmpData & | xmpData ()
| Returns an XmpData instance containing currently buffered XMP data.
virtual std::string & | xmpPacket ()
| Return a modifiable reference to the raw XMP packet.
void | writeXmpFromPacket (bool flag)
| Determine the source when writing XMP.
void | setByteOrder (ByteOrder byteOrder)
| Set the byte order to encode the Exif metadata in.
void | printTiffStructure (BasicIo &io, std::ostream &out, PrintStructureOption option, size_t depth, size_t offset=0)
| Print out the structure of image file.
void | printIFDStructure (BasicIo &io, std::ostream &out, Exiv2::PrintStructureOption option, size_t start, bool bSwap, char c, size_t depth)
| Print out the structure of a TIFF IFD.
static bool | isBigEndianPlatform ()
| is the host platform bigEndian
static bool | isLittleEndianPlatform ()
| is the host platform littleEndian
static bool | isStringType (uint16_t type)
static bool | isShortType (uint16_t type)
static bool | isLongType (uint16_t type)
static bool | isLongLongType (uint16_t type)
static bool | isRationalType (uint16_t type)
static bool | is2ByteType (uint16_t type)
static bool | is4ByteType (uint16_t type)
static bool | is8ByteType (uint16_t type)
static bool | isPrintXMP (uint16_t type, Exiv2::PrintStructureOption option)
static bool | isPrintICC (uint16_t type, Exiv2::PrintStructureOption option)
static uint64_t | byteSwap (uint64_t value, bool bSwap)
static uint32_t | byteSwap (uint32_t value, bool bSwap)
static uint16_t | byteSwap (uint16_t value, bool bSwap)
static uint16_t | byteSwap2 (const DataBuf &buf, size_t offset, bool bSwap)
static uint32_t | byteSwap4 (const DataBuf &buf, size_t offset, bool bSwap)
static uint64_t | byteSwap8 (const DataBuf &buf, size_t offset, bool bSwap)

## Detailed Description

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

Image has containers to store image metadata and subclasses implement read and save metadata from and to specific image formats.
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

## ◆ appendIccProfile()

void Exiv2::Image::appendIccProfile | ( | const uint8_t * | bytes,
|  | size_t | size,
|  | bool | bTestValid )

Append more bytes to the iccProfile.

Parameters

  bytes | array of bytes to append
  size | number of bytes to append
  bTestValid | - tests that iccProfile contains credible data

References Safe::add(), checkIccProfile(), and iccProfile_.

Referenced by Exiv2::JpegBase::readMetadata(), and writeMetadata().

## ◆ byteSwap8()

uint64_t Exiv2::Image::byteSwap8 | ( | const DataBuf & | buf,
|  | size_t | offset,
|  | bool | bSwap )
| static

## ◆ checkMode()

AccessMode Exiv2::Image::checkMode | ( | MetadataId | metadataId | ) | const
| nodiscard

Returns the access mode, i.e., the metadata functions, which this image supports for the metadata type metadataId.

Parameters

  metadataId | The metadata identifier.

Returns
  Access mode for the requested image type and metadata identifier.

References Exiv2::ImageFactory::checkMode().

Referenced by mimeType(), and setMetadata().

## ◆ clearXmpData()

void Exiv2::Image::clearXmpData | ( |  | ) |
| virtual

Erase any buffered XMP data. XMP data is not removed from the actual image until the writeMetadata() method is called.

This has the same effect as clearXmpPacket() but operates on the buffered parsed XMP data.

Subsequent calls to writeMetadata() encode the XMP data to a raw XMP packet and write the newly encoded packet to the image. In the process, the buffered raw XMP packet is updated. In order to write directly from the raw XMP packet, use writeXmpFromPacket(true) or setXmpPacket().

References writeXmpFromPacket(), and xmpData_.

Referenced by clearMetadata(), and writeMetadata().

## ◆ clearXmpPacket()

void Exiv2::Image::clearXmpPacket | ( |  | ) |
| virtual

Erase the buffered XMP packet. XMP data is not removed from the actual image until the writeMetadata() method is called.

This has the same effect as clearXmpData() but operates on the buffered raw XMP packet only, not the parsed XMP data.

Subsequent calls to writeMetadata() write the XMP packet from the buffered raw XMP packet rather than from buffered parsed XMP data. In order to write from parsed XMP data again, use either writeXmpFromPacket(false) or setXmpData().

References writeXmpFromPacket(), and xmpPacket_.

Referenced by clearMetadata(), and writeMetadata().

## ◆ exifData() [1/2]

ExifData & Exiv2::Image::exifData | ( |  | ) |
| 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

References exifData_.

Referenced by Exiv2::CrwParser::decode(), mimeType(), Exiv2::Jp2Image::readMetadata(), Exiv2::PgfImage::readMetadata(), Exiv2::Rw2Image::readMetadata(), setExifData(), setMetadata(), and writeMetadata().

## ◆ exifData() [2/2]

const ExifData & Exiv2::Image::exifData | ( |  | ) | const
| nodiscard 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

References exifData_.

## ◆ good()

bool Exiv2::Image::good | ( |  | ) | const
| nodiscard

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

Returns
  true if the Image is in a valid state.

References Exiv2::ImageFactory::checkType(), and io_.

## ◆ io()

BasicIo & Exiv2::Image::io | ( |  | ) | const
| nodiscard virtual

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

This reference 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.

References io_.

Referenced by Exiv2::AsfVideo::AsfVideo(), Exiv2::BmffImage::BmffImage(), Exiv2::BmpImage::BmpImage(), Exiv2::Cr2Image::Cr2Image(), Exiv2::CrwImage::CrwImage(), Exiv2::EpsImage::EpsImage(), Exiv2::ExvImage::ExvImage(), Exiv2::GifImage::GifImage(), Image(), Exiv2::Jp2Image::Jp2Image(), Exiv2::JpegBase::JpegBase(), Exiv2::JpegImage::JpegImage(), Exiv2::MatroskaVideo::MatroskaVideo(), mimeType(), Exiv2::MrwImage::MrwImage(), Exiv2::OrfImage::OrfImage(), Exiv2::PgfImage::PgfImage(), Exiv2::PngImage::PngImage(), printIFDStructure(), Exiv2::Cr2Image::printStructure(), Exiv2::OrfImage::printStructure(), Exiv2::RafImage::printStructure(), Exiv2::Rw2Image::printStructure(), Exiv2::TiffImage::printStructure(), Exiv2::WebPImage::printStructure(), printTiffStructure(), Exiv2::PsdImage::PsdImage(), Exiv2::QuickTimeVideo::QuickTimeVideo(), Exiv2::RafImage::RafImage(), Exiv2::CrwImage::readMetadata(), Exiv2::RiffVideo::RiffVideo(), Exiv2::Rw2Image::Rw2Image(), Exiv2::TgaImage::TgaImage(), Exiv2::TiffImage::TiffImage(), Exiv2::WebPImage::WebPImage(), and Exiv2::XmpSidecar::XmpSidecar().

## ◆ iptcData() [1/2]

IptcData & Exiv2::Image::iptcData | ( |  | ) |
| 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

References iptcData_.

Referenced by mimeType(), Exiv2::Jp2Image::readMetadata(), Exiv2::PgfImage::readMetadata(), setIptcData(), setMetadata(), and writeMetadata().

## ◆ iptcData() [2/2]

const IptcData & Exiv2::Image::iptcData | ( |  | ) | const
| nodiscard 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

References iptcData_.

## ◆ mimeType()

virtual std::string Exiv2::Image::mimeType | ( |  | ) | const
| nodiscard pure virtual

Return the MIME type of the image.

Note
  For each supported image format, the library knows only one MIME type. This may not be the most specific MIME type for that format. In particular, several RAW formats are variants of the TIFF format with the same magic as TIFF itself. Class TiffImage handles most of them and thus they all have MIME type "image/tiff", although a more specific MIME type may exist (e.g., "image/x-nikon-nef").

Implemented in Exiv2::AsfVideo, Exiv2::BmffImage, Exiv2::BmpImage, Exiv2::Cr2Image, Exiv2::CrwImage, Exiv2::EpsImage, Exiv2::ExvImage, Exiv2::GifImage, Exiv2::Jp2Image, Exiv2::JpegImage, Exiv2::MatroskaVideo, Exiv2::MrwImage, Exiv2::OrfImage, Exiv2::PgfImage, Exiv2::PngImage, Exiv2::PsdImage, Exiv2::QuickTimeVideo, Exiv2::RafImage, Exiv2::RiffVideo, Exiv2::Rw2Image, Exiv2::TgaImage, Exiv2::TiffImage, Exiv2::WebPImage, and Exiv2::XmpSidecar.

References checkMode(), comment(), exifData(), io(), iptcData(), nativePreviews(), pixelHeight(), pixelWidth(), supportsMetadata(), writeXmpFromPacket(), xmpData(), and xmpPacket().

## ◆ pixelHeight()

uint32_t Exiv2::Image::pixelHeight | ( |  | ) | const
| nodiscard virtual

Return the pixel height of the image.

Reimplemented in Exiv2::BmffImage, Exiv2::Cr2Image, Exiv2::CrwImage, Exiv2::MrwImage, Exiv2::OrfImage, Exiv2::RafImage, Exiv2::Rw2Image, and Exiv2::TiffImage.

References pixelHeight_.

Referenced by mimeType().

## ◆ pixelWidth()

uint32_t Exiv2::Image::pixelWidth | ( |  | ) | const
| nodiscard virtual

Return the pixel width of the image.

Reimplemented in Exiv2::BmffImage, Exiv2::Cr2Image, Exiv2::CrwImage, Exiv2::MrwImage, Exiv2::OrfImage, Exiv2::RafImage, Exiv2::Rw2Image, and Exiv2::TiffImage.

References pixelWidth_.

Referenced by mimeType().

## ◆ printStructure()

void Exiv2::Image::printStructure | ( | std::ostream & | out,
|  | PrintStructureOption | option = kpsNone,
|  | size_t | depth = 0 )
| virtual

Print out the structure of image file.

Exceptions

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

Warning
  This function is not thread safe and intended for exiv2 -pS for debugging.
  You may need to put the stream into binary mode (see src/actions.cpp)

Reimplemented in Exiv2::BmffImage, Exiv2::Cr2Image, Exiv2::Jp2Image, Exiv2::JpegBase, Exiv2::OrfImage, Exiv2::PngImage, Exiv2::RafImage, Exiv2::Rw2Image, Exiv2::TiffImage, and Exiv2::WebPImage.

References io_.

Referenced by ~Image().

## ◆ printTiffStructure()

void Exiv2::Image::printTiffStructure | ( | BasicIo & | io,
|  | std::ostream & | out,
|  | Exiv2::PrintStructureOption | option,
|  | size_t | depth,
|  | size_t | offset = 0 )

Print out the structure of image file.

Exceptions

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

References Exiv2::DataBuf::data(), io(), isBigEndianPlatform(), isLittleEndianPlatform(), and printIFDStructure().

Referenced by printIFDStructure(), Exiv2::Cr2Image::printStructure(), Exiv2::Jp2Image::printStructure(), Exiv2::JpegBase::printStructure(), Exiv2::OrfImage::printStructure(), Exiv2::Rw2Image::printStructure(), Exiv2::TiffImage::printStructure(), and Exiv2::WebPImage::printStructure().

## ◆ readMetadata()

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 image metadata will be cleared.

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::AsfVideo, Exiv2::BmffImage, Exiv2::BmpImage, Exiv2::Cr2Image, Exiv2::CrwImage, Exiv2::EpsImage, Exiv2::GifImage, Exiv2::Jp2Image, Exiv2::JpegBase, Exiv2::MatroskaVideo, Exiv2::MrwImage, Exiv2::OrfImage, Exiv2::PgfImage, Exiv2::PngImage, Exiv2::PsdImage, Exiv2::QuickTimeVideo, Exiv2::RafImage, Exiv2::RiffVideo, Exiv2::Rw2Image, Exiv2::TgaImage, Exiv2::TiffImage, Exiv2::WebPImage, and Exiv2::XmpSidecar.

## ◆ setByteOrder()

void Exiv2::Image::setByteOrder | ( | ByteOrder | byteOrder | ) |

Set the byte order to encode the Exif metadata in.

The setting is only used when new Exif metadata is created and may not be applicable at all for some image formats. If the target image already contains Exif metadata, the byte order of the existing data is used. If byte order is not set when writeMetadata() is called, little-endian byte order (II) is used by default.

References byteOrder().

Referenced by Exiv2::Cr2Image::readMetadata(), Exiv2::Jp2Image::readMetadata(), Exiv2::JpegBase::readMetadata(), Exiv2::MrwImage::readMetadata(), Exiv2::OrfImage::readMetadata(), Exiv2::RafImage::readMetadata(), Exiv2::Rw2Image::readMetadata(), Exiv2::TiffImage::readMetadata(), Exiv2::Cr2Image::writeMetadata(), Exiv2::OrfImage::writeMetadata(), and Exiv2::TiffImage::writeMetadata().

## ◆ setComment()

void Exiv2::Image::setComment | ( | const std::string & | comment | ) |
| virtual

Set the image comment. The comment is written to the image when writeMetadata() is called.

Reimplemented in Exiv2::BmffImage, Exiv2::BmpImage, Exiv2::Cr2Image, Exiv2::EpsImage, Exiv2::GifImage, Exiv2::Jp2Image, Exiv2::MrwImage, Exiv2::OrfImage, Exiv2::PsdImage, Exiv2::RafImage, Exiv2::Rw2Image, Exiv2::TgaImage, Exiv2::TiffImage, Exiv2::WebPImage, and Exiv2::XmpSidecar.

References comment(), and comment_.

Referenced by setMetadata(), and writeMetadata().

## ◆ setExifData()

void Exiv2::Image::setExifData | ( | const ExifData & | exifData | ) |
| 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

Reimplemented in Exiv2::BmffImage, Exiv2::BmpImage, Exiv2::GifImage, Exiv2::MrwImage, Exiv2::RafImage, Exiv2::Rw2Image, and Exiv2::TgaImage.

References exifData(), and exifData_.

Referenced by setMetadata(), and writeMetadata().

## ◆ setIccProfile()

void Exiv2::Image::setIccProfile | ( | Exiv2::DataBuf && | iccProfile,
|  | bool | bTestValid = true )
| virtual

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

Parameters

  iccProfile | DataBuf containing profile (binary)
  bTestValid | - tests that iccProfile contains credible data

References checkIccProfile(), iccProfile(), and iccProfile_.

Referenced by Exiv2::Jp2Image::readMetadata(), setMetadata(), and writeMetadata().

## ◆ setIptcData()

void Exiv2::Image::setIptcData | ( | const IptcData & | iptcData | ) |
| 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

Reimplemented in Exiv2::BmffImage, Exiv2::BmpImage, Exiv2::CrwImage, Exiv2::GifImage, Exiv2::MrwImage, Exiv2::RafImage, Exiv2::Rw2Image, Exiv2::TgaImage, and Exiv2::WebPImage.

References iptcData(), and iptcData_.

Referenced by setMetadata(), and writeMetadata().

## ◆ setMetadata()

void Exiv2::Image::setMetadata | ( | const Image & | image | ) |
| 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.

References checkMode(), comment(), exifData(), iccProfile(), Image(), iptcData(), setComment(), setExifData(), setIccProfile(), setIptcData(), setXmpData(), setXmpPacket(), xmpData(), and xmpPacket().

## ◆ setXmpData()

void Exiv2::Image::setXmpData | ( | const XmpData & | xmpData | ) |
| virtual

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

Subsequent calls to writeMetadata() encode the XMP data to a raw XMP packet and write the newly encoded packet to the image. In the process, the buffered raw XMP packet is updated. In order to write directly from the raw XMP packet, use writeXmpFromPacket(true) or setXmpPacket().

Parameters

  xmpData | An XmpData instance holding XMP data to be copied

Reimplemented in Exiv2::BmffImage.

References writeXmpFromPacket(), xmpData(), and xmpData_.

Referenced by setMetadata(), and writeMetadata().

## ◆ setXmpPacket()

void Exiv2::Image::setXmpPacket | ( | const std::string & | xmpPacket | ) |
| virtual

Assign a raw XMP packet. The new XMP packet is not written to the image until the writeMetadata() method is called.

Subsequent calls to writeMetadata() write the XMP packet from the buffered raw XMP packet rather than from buffered parsed XMP data. In order to write from parsed XMP data again, use either writeXmpFromPacket(false) or setXmpData().

Parameters

  xmpPacket | A string containing the raw XMP packet.

References Exiv2::XmpParser::decode(), xmpData_, xmpPacket(), and xmpPacket_.

Referenced by setMetadata(), and writeMetadata().

## ◆ supportsMetadata()

bool Exiv2::Image::supportsMetadata | ( | MetadataId | metadataId | ) | const
| nodiscard

Check if image supports a particular type of metadata. This method is deprecated. Use checkMode() instead.

Referenced by mimeType().

## ◆ typeName()

const char * Exiv2::Image::typeName | ( | uint16_t | tag | ) |
| static protected

Return tag type for given tag id.

List of TIFF image tags

References Exiv2::asciiString, Exiv2::signedByte, Exiv2::signedLong, Exiv2::signedRational, Exiv2::signedShort, Exiv2::tiffDouble, Exiv2::tiffFloat, Exiv2::tiffIfd, Exiv2::undefined, Exiv2::unsignedByte, Exiv2::unsignedLong, Exiv2::unsignedRational, and Exiv2::unsignedShort.

Referenced by printIFDStructure().

## ◆ writeMetadata()

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::AsfVideo, Exiv2::BmffImage, Exiv2::BmpImage, Exiv2::Cr2Image, Exiv2::CrwImage, Exiv2::EpsImage, Exiv2::GifImage, Exiv2::Jp2Image, Exiv2::JpegBase, Exiv2::MatroskaVideo, Exiv2::MrwImage, Exiv2::OrfImage, Exiv2::PgfImage, Exiv2::PngImage, Exiv2::PsdImage, Exiv2::QuickTimeVideo, Exiv2::RafImage, Exiv2::RiffVideo, Exiv2::Rw2Image, Exiv2::TgaImage, Exiv2::TiffImage, Exiv2::WebPImage, and Exiv2::XmpSidecar.

References appendIccProfile(), checkIccProfile(), clearComment(), clearExifData(), clearIccProfile(), clearIptcData(), clearXmpData(), clearXmpPacket(), comment(), exifData(), iccProfile(), iptcData(), setComment(), setExifData(), setIccProfile(), setIptcData(), setXmpData(), setXmpPacket(), xmpData(), and xmpPacket().

## ◆ writeXmpFromPacket()

void Exiv2::Image::writeXmpFromPacket | ( | bool | flag | ) |

Determine the source when writing XMP.

Depending on the setting of this flag, writeMetadata() writes XMP from the buffered raw XMP packet or from parsed XMP data. The default is to write from parsed XMP data. The switch is also set by all functions to set and clear the buffered raw XMP packet and parsed XMP data, so using this function should usually not be necessary.

If Exiv2 was compiled without XMP support, the default for this flag is true and it will never be changed in order to preserve access to the raw XMP packet.

Referenced by mimeType(), and xmpPacket().

## ◆ xmpData() [1/2]

XmpData & Exiv2::Image::xmpData | ( |  | ) |
| virtual

Returns an XmpData instance containing currently buffered XMP data.

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

Returns
  modifiable XmpData instance containing XMP values

References xmpData_.

Referenced by Exiv2::AsfVideo::codecList(), Exiv2::AsfVideo::contentDescription(), Exiv2::AsfVideo::extendedContentDescription(), Exiv2::AsfVideo::extendedStreamProperties(), Exiv2::AsfVideo::fileProperties(), mimeType(), Exiv2::AsfVideo::readMetadata(), Exiv2::Jp2Image::readMetadata(), Exiv2::PgfImage::readMetadata(), setMetadata(), setXmpData(), Exiv2::AsfVideo::streamProperties(), writeMetadata(), and Exiv2::TiffImage::writeMetadata().

## ◆ xmpData() [2/2]

const XmpData & Exiv2::Image::xmpData | ( |  | ) | const
| nodiscard virtual

Returns an XmpData instance containing currently buffered XMP data.

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

Returns
  modifiable XmpData instance containing XMP values

References xmpData_.

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

- image.hpp
- image.cpp