Structure Description: PhotoshopFile#

A near-identical representation of the Photoshop File Format in-memory. This struct, and all of its members do the parsing and verifying of the input and output data.

Note

This part of the documentation does not cover every struct associated with the PhotoshopFile as it is not meant to be interacted with directly and therefore only covers the high level structures with some further insights. Please refer to both the Photoshop File Format Specification as well as the source code to find out more about some of the specific details

Photoshop File Section#

Below you can find a list of sections that exist in a Photoshop File

PhotoshopFile Struct#


struct PhotoshopFile#

A Photoshop File (*.psd or *.psb) parsed into this struct to then later be parsed into the LayeredFile structure. This is split into two distinct steps to have a programming interface to parse against rather than the raw file structure

Public Functions

PhotoshopFile() = default#
inline PhotoshopFile(FileHeader header, ColorModeData colorModeData, ImageResources &&imageResources, LayerAndMaskInformation &&layerMaskInfo, ImageData imageData)#

Initialize a PhotoshopFile struct from the individual sections.

void read(File &document)#

Read and Initialize this struct from a File.

Parameters:

document – the file object to read the data from

void write(File &document)#

Write the PhotoshopFile struct to disk.

Parameters:

document – the file object to write the data to

Public Members

FileHeader m_Header#

The documents FileHeader holding information such as BitDepth, Size and ColorMode.

ColorModeData m_ColorModeData#

The ColorModeData defining color mapping for some color and depth types.

ImageResources m_ImageResources#

A series of ImageResourceBlocks with additional, document related, information.

LayerAndMaskInformation m_LayerMaskInfo#

The Section in which Photoshop stores its layer data, this also contains the image pixels themselves.

ImageData m_ImageData = {}#

This section is for interoperability with different software such as lightroom and stores a merged composite of the layer hierarchy. This sections existence is supposed to be toggled by the ‘Maximize Compatibility’ but there is a bug which means that often it gets written out either way and photoshop actually also expects this section to be there.