Exiv2
Public Types | Static Public Member Functions | Friends | List of all members
Exiv2::Internal::PngChunk Class Reference

Stateless parser class for data in PNG chunk format. Images use this class to decode and encode PNG-based data. More...

#include <pngchunk_int.hpp>

Public Types

enum  TxtChunkType { tEXt_Chunk = 0, zTXt_Chunk = 1, iTXt_Chunk = 2 }
 Text Chunk types.
 

Static Public Member Functions

static void decodeIHDRChunk (const DataBuf &data, int *outWidth, int *outHeight)
 Decode PNG IHDR chunk data from a data buffer data and return image size to outWidth and outHeight. More...
 
static void decodeTXTChunk (Image *pImage, const DataBuf &data, TxtChunkType type)
 Decode PNG tEXt, zTXt, or iTXt chunk data from pImage passed by data buffer data and extract Comment, Exif, Iptc, Xmp metadata accordingly. More...
 
static DataBuf decodeTXTChunk (const DataBuf &data, TxtChunkType type)
 Decode PNG tEXt, zTXt, or iTXt chunk data from pImage passed by data buffer data and extract Comment, Exif, Iptc, Xmp to DataBuf. More...
 
static DataBuf keyTXTChunk (const DataBuf &data, bool stripHeader=false)
 Return PNG TXT chunk key as data buffer. More...
 
static std::string makeMetadataChunk (const std::string &metadata, MetadataId type)
 Return a complete PNG chunk data compressed or not as buffer. Data returned is formated accordingly with metadata type to host passed by metadata. More...
 

Friends

class Exiv2::PngImage
 

Detailed Description

Stateless parser class for data in PNG chunk format. Images use this class to decode and encode PNG-based data.

Member Function Documentation

◆ decodeIHDRChunk()

static void Exiv2::Internal::PngChunk::decodeIHDRChunk ( const DataBuf data,
int *  outWidth,
int *  outHeight 
)
static

Decode PNG IHDR chunk data from a data buffer data and return image size to outWidth and outHeight.

Parameters
dataPNG Chunk data buffer.
outWidthInteger pointer to be set to the width of the image.
outHeightInteger pointer to be set to the height of the image.

◆ decodeTXTChunk() [1/2]

static void Exiv2::Internal::PngChunk::decodeTXTChunk ( Image pImage,
const DataBuf data,
TxtChunkType  type 
)
static

Decode PNG tEXt, zTXt, or iTXt chunk data from pImage passed by data buffer data and extract Comment, Exif, Iptc, Xmp metadata accordingly.

Parameters
pImagePointer to the image to hold the metadata
dataPNG Chunk data buffer.
typePNG Chunk TXT type.

◆ decodeTXTChunk() [2/2]

static DataBuf Exiv2::Internal::PngChunk::decodeTXTChunk ( const DataBuf data,
TxtChunkType  type 
)
static

Decode PNG tEXt, zTXt, or iTXt chunk data from pImage passed by data buffer data and extract Comment, Exif, Iptc, Xmp to DataBuf.

Parameters
dataPNG Chunk data buffer.
typePNG Chunk TXT type.

◆ keyTXTChunk()

static DataBuf Exiv2::Internal::PngChunk::keyTXTChunk ( const DataBuf data,
bool  stripHeader = false 
)
static

Return PNG TXT chunk key as data buffer.

Parameters
dataPNG Chunk data buffer.
stripHeaderSet true if chunk data start with header bytes, else false (default).

◆ makeMetadataChunk()

static std::string Exiv2::Internal::PngChunk::makeMetadataChunk ( const std::string &  metadata,
MetadataId  type 
)
static

Return a complete PNG chunk data compressed or not as buffer. Data returned is formated accordingly with metadata type to host passed by metadata.

Parameters
metadatametadata buffer.
typemetadata type.

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