psd_tools.psd.header

File header structure.

FileHeader

class psd_tools.psd.header.FileHeader(signature: bytes = b'8BPS', version: int = 1, channels: int = 4, height: int = 64, width: int = 64, depth: int = 8, color_mode=ColorMode.RGB)[source]

Header section of the PSD file.

Example:

from psd_tools.psd.header import FileHeader
from psd_tools.constants import ColorMode

header = FileHeader(channels=2, height=359, width=400, depth=8,
                    color_mode=ColorMode.GRAYSCALE)
signature

Signature: always equal to b'8BPS'.

version

Version number. PSD is 1, and PSB is 2.

channels

The number of channels in the image, including any user-defined alpha channel.

height

The height of the image in pixels.

width

The width of the image in pixels.

depth

The number of bits per channel.

color_mode

The color mode of the file. See ColorMode