Introduction
PSD is the native file format of Adobe Photoshop. It keeps a whole working document: every layer with its blend mode and opacity, masks, adjustment layers, text, paths, guides and colour profiles, as well as a flattened copy of the finished image.
Adobe publishes a specification of the format. Documents larger than 30,000 pixels on a side or 2 GB in size use the Large Document Format, PSB, which has the same layout with wider length fields. Many other editors read PSD, though each supports a different share of Photoshop’s features.
Structure
A PSD file has five sections in a fixed order, and all numbers are big-endian. The
26-byte header starts with 8BPS and gives the version (1 for PSD, 2 for PSB),
the number of channels, the height and width, the bits per channel and the colour mode.
Each later section starts with its own length, so a reader can skip what it does not
need.
0File header8BPS, version, channels, size, depth, colour mode26 bytes26Colour mode data the palette of an indexed image, otherwise empty4 bytes and up…Image resources8BIMblocks: resolution, guides, thumbnail, profilevaries…Layer and mask information each layer’s bounds, blend mode, masks and pixel channelsvaries…Image data the flattened composite, raw or compressedvaries
Links
Software
- Adobe Photoshop (Windows, macOS)
- Photopea (web browser)
- GIMP (Windows, macOS, Linux)
- Krita (Windows, macOS, Linux)
- Affinity Photo (Windows, macOS, iPad)
- XnView MP (Windows, macOS, Linux)
- ImageMagick (Windows, macOS, Linux)
Developers
- psd-tools, Python library that reads layers and the composite