PSD File Format
PSD is a binary file format which means that all data is stored in a format not readable by human. Specialized software which can read PSD file format is needed to display it.
Each PSD file contains five following sections:
- File header – contains some important properties of the image like width, height, color depth, image color mode.
- Color mode data – stores color tables used by the image. This section only has actual data when image color mode in the header is set to “Indexed Color” or “Duotone”. For “Duotone” image color mode setting this section will contain information about duotone color image in a format not documented by Adobe. For “Indexed Color” image mode the table will contain color table with length of 768 bytes (3 bytes for each color) in non-interleaved order.
- Image resources – stores information about additional image properties, objects and resources. For example, it can store clipping paths information, print styles, EXIF data and many more.
- Layer and mask data – stores data about all layers and masks used by the image. Each layer can have multiple properties including blend mode, opacity, clipping, border rectangle, color channel information, layer mask data, layer name, and others.
- Image data – raw pixels of the image. Could be stored in raw image format, RLE compression, ZIP with/without prediction. Raw pixel data in PSD files is stored in planar order. This means that red color plane data goes first, then green color plane, etc.
Each PSD file starts with ‘8BPS’ characters. File binary data with all sections described above follows after it.
Maximum possible size of the PSD file is 30,000 pixels by 30,000 pixels. Adobe Photoshop also supports PSB file format which can store larger images up to 300,000 pixels wide and 300,000 pixels tall.
You can get more details about PSD file, including PSB from Adobe Photoshop File Formats Specification. This specification also includes EPS, TIFF and the format in which Adobe Photoshop creates them.