Exiv2::Photoshop Struct Reference

Helper class, has methods to deal with Photoshop "Information Resource Blocks" (IRBs). More...

#include <photoshop.hpp>

Static Public Member Functions

static bool isIrb (const byte *pPsData)
 Checks an IRB. More...
 
static bool valid (const byte *pPsData, size_t sizePsData)
 Validates all IRBs. More...
 
static int locateIrb (const byte *pPsData, size_t sizePsData, uint16_t psTag, const byte **record, uint32_t &sizeHdr, uint32_t &sizeData)
 Locates the data for a Photoshop tag in a Photoshop formatted memory buffer. Operates on raw data to simplify reuse. More...
 
static int locateIptcIrb (const byte *pPsData, size_t sizePsData, const byte **record, uint32_t &sizeHdr, uint32_t &sizeData)
 Forwards to locateIrb() with psTag = iptc_.
 
static int locatePreviewIrb (const byte *pPsData, size_t sizePsData, const byte **record, uint32_t &sizeHdr, uint32_t &sizeData)
 Forwards to locatePreviewIrb() with psTag = preview_.
 
static DataBuf setIptcIrb (const byte *pPsData, size_t sizePsData, const IptcData &iptcData)
 Set the new IPTC IRB, keeps existing IRBs but removes the IPTC block if there is no new IPTC data to write. More...
 

Static Public Attributes

static constexpr std::array< const char *, 4 > irbId_ {"8BIM", "AgHg", "DCSR", "PHUT"}
 Photoshop IRB markers
 
static constexpr auto ps3Id_ = "Photoshop 3.0\0"
 Photoshop marker
 
static constexpr uint16_t iptc_ = 0x0404
 Photoshop IPTC marker
 
static constexpr uint16_t preview_ = 0x040c
 Photoshop preview marker
 

Detailed Description

Helper class, has methods to deal with Photoshop "Information Resource Blocks" (IRBs).

Member Function Documentation

◆ isIrb()

static bool Exiv2::Photoshop::isIrb ( const byte pPsData)
static

Checks an IRB.

Parameters
pPsDataExisting IRB buffer. It is expected to be of size 4.
Returns
true if the IRB marker is known
Todo:
This should be an implementation detail and not exposed in the API. An attacker could try to pass a smaller buffer or null pointer.

◆ locateIrb()

static int Exiv2::Photoshop::locateIrb ( const byte pPsData,
size_t  sizePsData,
uint16_t  psTag,
const byte **  record,
uint32_t &  sizeHdr,
uint32_t &  sizeData 
)
static

Locates the data for a Photoshop tag in a Photoshop formatted memory buffer. Operates on raw data to simplify reuse.

Parameters
pPsDataPointer to buffer containing entire payload of Photoshop formatted data (from APP13 Jpeg segment)
sizePsDataSize in bytes of pPsData.
psTagTag number of the block to look for.
recordOutput value that is set to the start of the data block within pPsData (may not be null).
sizeHdrOutput value that is set to the size of the header within the data block pointed to by record (may not be null).
sizeDataOutput value that is set to the size of the actual data within the data block pointed to by record (may not be null).
Returns
0 if successful;
3 if no data for psTag was found in pPsData;
-2 if the pPsData buffer does not contain valid data.

◆ setIptcIrb()

static DataBuf Exiv2::Photoshop::setIptcIrb ( const byte pPsData,
size_t  sizePsData,
const IptcData iptcData 
)
static

Set the new IPTC IRB, keeps existing IRBs but removes the IPTC block if there is no new IPTC data to write.

Parameters
pPsDataExisting IRB buffer
sizePsDataSize of the IRB buffer, may be 0
iptcDataIptc data to embed, may be empty
Returns
A data buffer containing the new IRB buffer, may have 0 size

◆ valid()

static bool Exiv2::Photoshop::valid ( const byte pPsData,
size_t  sizePsData 
)
static

Validates all IRBs.

Parameters
pPsDataExisting IRB buffer
sizePsDataSize of the IRB buffer, may be 0
Returns
true if all IRBs are valid;
false otherwise

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