File Header Structure#

struct FileHeader : public FileSection#

Public Functions

FileHeader() = default#
inline FileHeader(Enum::Version version, uint16_t numChannels, uint32_t width, uint32_t height, Enum::BitDepth depth, Enum::ColorMode colorMode)#
inline virtual uint64_t calculateSize(std::shared_ptr<FileHeader> header = nullptr) const override#

Each FileSection must implement a way to calculate its own section size in bytes based on the data it holds. This is important for writing to disk as we sometimes hold a section size marker. The size must include this marker (if applicable) and when writing the marker we subtract the size of it.

Note

Any sections that include image data (LayerAndMaskInformation and ImageData) will not be able to calculate the section size due to offloading the compression to the write step. For these sections the size calculation gets done on write.

Parameters:

header – An optional ptr to the document FileHeader, only some functions require this to be present

void read(File &document)#

Read and Initialize the FileHeader from disk.

void write(File &document)#

Write out the data held by the struct in a Photoshop compliant way.

Public Members

Signature m_Signature#

Has to be ‘8BPS’.

Enum::Version m_Version#

The type of file we are dealing with.

uint16_t m_NumChannels#

Supported range by Photoshop is 1-56. This does not account for mask channels.

uint32_t m_Height#

1 - 30,000 for PSD and 1 - 300,000 for PSB

uint32_t m_Width#

1 - 30,000 for PSD and 1 - 300,000 for PSB

Enum::BitDepth m_Depth#

Depth of the Document.

Enum::ColorMode m_ColorMode#

Color Mode of the file.