Everything Photoshop added to layers after version 3 is stored in tagged blocks: adjustment layers, effects, type, groups, smart objects and more. They appear at the end of each layer record and, for the whole document, at the end of the layer and mask information section. A reader skips any key it does not know.
Block layout
| Size | Type | Name | Description |
|---|---|---|---|
| 4 | char[4] | Signature | 8BIM or 8B64. |
| 4 | char[4] | Key | The key, from the tables below. |
| 4/8 | u32/u64 | Length | Length of the data, rounded up to an even number. 8 bytes in a PSB file for the keys LMsk, Lr16, Lr32, Layr, Mt16, Mt32, Mtrn, Alph, FMsk, lnk2, FEid, FXid and PxSD, and, as files show, pths, cinf and lnkE (also lnk3, FELS, extd, extn and artd in open-source readers); 4 bytes otherwise.
In the blocks at the end of the layer and mask information section the data is padded to a multiple of 4 bytes; in a layer record, to an even length. The padding can be inside the length or follow it. |
| Length | bytes | Data | Depends on the key. |
Many blocks hold an Action descriptor, usually after a 4-byte descriptor version of 16.
Adjustment and fill layers
| Key | Layer |
|---|---|
SoCo | Solid colour fill: descriptor version and descriptor. |
GdFl | Gradient fill: descriptor version and descriptor. |
PtFl | Pattern fill: descriptor version and descriptor. |
brit | Brightness and contrast. |
levl | Levels. |
curv | Curves. |
expA | Exposure. |
vibA | Vibrance. |
hue | Hue and saturation, Photoshop 4.0 form. |
hue2 | Hue and saturation, Photoshop 5.0 and later. |
blnc | Colour balance. |
blwh | Black and white. |
phfl | Photo filter. |
mixr | Channel mixer. |
clrL | Colour lookup. |
nvrt | Invert. Its data is not described by the specification. |
post | Posterise. |
thrs | Threshold. |
grdm | Gradient map, and gradient settings (Photoshop 6.0). Layout below. |
selc | Selective colour. |
The layout of each of these blocks, and which ones Adobe leaves undocumented
(blnc, nvrt, post, thrs), is on
the adjustment layers page.
Effects
| Key | Contents |
|---|---|
lrFX | Layer effects, Photoshop 5.0 binary form. Layout below. |
lfx2 | Object-based effects, Photoshop 6.0 and later: 4-byte effects version (0), 4-byte descriptor version (16), descriptor. |
FEid, FXid | Filter effects (smart filter pixel data). Layout below. |
ffxi | Foreign effect ID: 4 bytes. |
FMsk | Filter mask: 10-byte colour space and colour, 2-byte opacity. |
anFX | Animation effects (CS6): 4-byte descriptor version (16), descriptor. |
lrFX
A 2-byte version (0) and a 2-byte effect count (6 in Photoshop 5.0 and 6.0, 7 in 7.0),
then each effect as a 8BIM signature, a 4-byte effect key and its data.
A colour is 10 bytes: a 2-byte colour space ID and four 2-byte components. A blend
mode is 8 bytes: 8BIM and a key.
| Effect key | Effect | Fields in order (bytes) |
|---|---|---|
cmnS | Common state | size 4 (7), version 4 (0), visible 1 (always true), unused 2. |
dsdw | Drop shadow | size 4 (41 or 51), version 4 (0 in 5.0, 2 in 5.5), blur 4, intensity 4, angle 4, distance 4, colour 10, blend mode 8, enabled 1, use global angle 1, opacity 1, native colour 10. |
isdw | Inner shadow | As the drop shadow. |
oglw | Outer glow | size 4 (32 or 42), version 4, blur 4, intensity 4, colour 10, blend mode 8, enabled 1, opacity 1; version 2 adds native colour 10. |
iglw | Inner glow | size 4 (33 or 43), version 4, blur 4, intensity 4, colour 10, blend mode 8, enabled 1, opacity 1; version 2 adds invert 1 and native colour 10. |
bevl | Bevel | size 4 (58 or 78), version 4, angle 4, depth 4, blur 4, highlight blend mode 8, shadow blend mode 8, highlight colour 10, shadow colour 10, style 1, highlight opacity 1, shadow opacity 1, enabled 1, use global angle 1, direction 1 (up or down); version 2 adds real highlight colour 10 and real shadow colour 10. |
sofi | Solid fill (7.0) | size 4 (34), version 4 (2), blend key 4, colour 10, opacity 1, enabled 1, native colour 10. |
FEid and FXid
| Size | Name | Description |
|---|---|---|
| 4 | Version | 1, 2 or 3. |
| 8 | Length | Length of the data that follows, which repeats the record below. |
| varies | ID | Pascal string identifier. |
| 4 | Version | 1. |
| 8 | Length | Length. |
| 16 | Rect | Top, left, bottom, right. |
| 4 | Depth | Depth. |
| 4 | MaxChannels | Maximum channels. |
| varies | Channels | For each channel plus a user mask and a sheet mask: 4-byte “written” flag, 8-byte length, 2-byte compression mode, data. |
| 1 | HasExtra | Whether the next two items are present. |
| 2 | Compression | Compression mode of the data that follows. |
| varies | Data | Data. |
The specification does not list the compression mode values here; the image data section uses 0 raw, 1 RLE, 2 ZIP, 3 ZIP with prediction.
Type and vector data
| Key | Contents |
|---|---|
tySh | Type tool information, Photoshop 5.0 and 5.5. Layout below. |
TySh | Type tool object, Photoshop 6.0 and later. Layout below. |
Txt2 | Text engine data (CS3): a 4-byte length, then the text engine markup (below). |
vmsk | Vector mask: 4-byte version (3), 4-byte flags (value 1 invert, 2 not linked, 4 disabled; the specification numbers these bits 1 to 3), then path records to the end. |
vsms | The same vector mask, written by CS6 and later together with vscg. |
vscg | Vector stroke content (CS6): 4-byte key, 4-byte descriptor version (16), descriptor. |
vstk | Vector stroke (CS6): 4-byte descriptor version (16), descriptor. |
vogk | Vector origination (CC): 4-byte version (1), 4-byte descriptor version (16), descriptor. |
pths | Unicode path names (CS6): 4-byte descriptor version (16), descriptor holding the list of names. |
tySh
Superseded by TySh in Photoshop 6.0.
| Size | Name | Description |
|---|---|---|
| 2 | Version | 1. |
| 48 | Transform | Six doubles. |
| 2 | FontVersion | 6. |
| 2 | FaceCount | Then for each face: mark 2, font type 4, font name (Pascal string), family name (Pascal string), style name (Pascal string), script 2, number of design axes 4, design vector value 4. |
| 2 | StyleCount | Then for each style: mark 2, face mark 2, size 4, tracking 4, kerning 4, leading 4, baseline shift 4, auto kern 1, a byte present only in versions up to 5, rotate up/down 1. |
| 2 | Type | Text type. |
| 4 | Scaling | Scaling factor. |
| 4 | CharacterCount | Character count. |
| 4 + 4 | Placement | Horizontal and vertical placement. |
| 4 + 4 | Selection | Selection start and end. |
| 2 | LineCount | Then for each line: character count 4, orientation 2, alignment 2, actual character as a double-byte character 2, style 2. |
| 2 | ColorSpace | Colour space. |
| 8 | Color | Four 2-byte components. |
| 1 | AntiAlias | On or off. |
TySh
| Size | Type | Name | Description |
|---|---|---|---|
| 2 | u16 | Version | 1. |
| 48 | f64[6] | Transform | xx, xy, yx, yy, tx, ty. |
| 2 | u16 | TextVersion | 50. |
| 4 | u32 | DescriptorVersion | 16. |
| varies | descriptor | TextData | The text, its style runs and the text engine data (the item EngineData, a raw-data value: below). |
| 2 | u16 | WarpVersion | 1. |
| 4 | u32 | DescriptorVersion | 16. |
| varies | descriptor | WarpData | Text warp settings. |
| 16 | f32[4] | Bounds | Left, top, right, bottom of the text box, four 32-bit floats. (Adobe’s specification gives 32 bytes, four doubles; Photoshop writes 16.) Followed by padding to a multiple of four bytes. |
Text engine data
The text engine data of a type layer (the EngineData item of TySh, and the content of
Txt2) is text in a small PostScript-like markup:
<< … >>is a dictionary of/Name valuepairs.[ … ]is an array.(…)is a string. Text starts with the byte order markFE FFand is UTF-16 big-endian;(,)and\inside it are escaped with a backslash. A paragraph ends with a carriage return (000D).- Numbers are written as
12,-3or0.5, booleans astrueandfalse.
The top-level keys are EngineDict (Editor, which holds the text in Text;
ParagraphRun and StyleRun, the paragraph and character styles by run; GridInfo;
AntiAlias; UseFractionalGlyphWidths; Rendered), ResourceDict and
DocumentResources (the two have the same keys: FontSet, whose items have a Name,
StyleSheetSet, ParagraphSheetSet, KinsokuSet, MojiKumiSet and
the superscript, subscript and small-capital sizes and positions). Tokens are separated by tabs and line feeds.
Layer identity and settings
| Key | Contents |
|---|---|
luni | The layer name as a Unicode string. |
lyid | Layer ID: 4 bytes. |
lnsr | Layer name source: a 4-byte ID. |
lyvr | Layer version: 4 bytes, the minimum Photoshop version that can read the layer without loss, such as 70 for 7.0 and 80 for 8.0. At least 70. |
lspf | Protected settings: 4 bytes of flags; bit 0 transparency, bit 1 composite, bit 2 position. |
lclr | Sheet colour: 8 bytes; only the first colour value is used. |
fxrp | Reference point: two 8-byte doubles. |
shmd | Metadata settings: a 4-byte count, then items of a 8BIM signature, a 4-byte key, a copy-on-sheet-duplication byte, 3 padding bytes, a 4-byte length and the data (often a descriptor). The key mdyn (animation frame flags) is not a descriptor: a 2-byte unknown, a byte that is 0 when frame one is propagated, and a flag byte (bit 0 unify layer position, bit 1 unify layer style, bit 2 unify layer visibility), as ag-psd reads it. |
Anno | Annotations. Layout below. |
sn2P | Aligned rendering: 4 bytes, non-zero for on. |
cinf | Compositor used (2020): descriptor version (16) and descriptor. |
CgEd | Content generator extra data (CS5): 4-byte descriptor version (16), descriptor. |
artb, artd, abdd | Artboard data: descriptor version (16) and descriptor. |
Groups, masks and blending
| Key | Contents |
|---|---|
lsct | Section divider, which marks a layer group. Layout below. |
clbl | Blend clipped elements: 1 byte boolean, 3 padding. |
infx | Blend interior elements: 1 byte boolean, 3 padding. |
knko | Knockout: 1 byte boolean, 3 padding. |
tsly | Transparency shapes layer: 1 byte (1 layer transparency shapes effects, 0 treated as fill opacity), 3 padding. |
lmgm | Layer mask as global mask: 1 byte (1 the mask is applied last, over the layer and its effects), 3 padding. |
vmgm | Vector mask as global mask: the same, for the vector mask. |
brst | Channel blending restrictions: a 4-byte channel number for each channel that is turned off. |
LMsk | User mask (document-level): 10-byte colour space and colour, 2-byte opacity, 1-byte flag (128). |
Mtrn, Mt16, Mt32 | Saved transparency of the merged image, for 8-, 16- and 32-bit documents. No data of their own. |
Alph | Listed with an 8-byte PSB length; its contents are not described by the specification, psd-tools (“undocumented”) or the other readers consulted. |
vowv | Vector origination, unknown: a 4-byte number, always 2 in the files ag-psd read. |
CAI | Content Authenticity Initiative data (CC): a 4-byte version (3 in the files ag-psd read), a descriptor with its own version (16) and 8 zero bytes. |
lsct
Photoshop stores a group as a run of layers between two markers: a hidden “bounding
section divider” layer at the bottom of the group and the group layer itself at the
top, both carrying lsct.
| Size | Type | Name | Description |
|---|---|---|---|
| 4 | u32 | Type | 0 any other kind of layer, 1 open folder, 2 closed folder, 3 bounding section divider (hidden in the user interface). |
| 4 | char[4] | Signature | Only if the length is at least 12: 8BIM. |
| 4 | char[4] | BlendMode | Only if the length is at least 12: the group’s blend mode key. |
| 4 | u32 | SubType | Only if the length is at least 16: 0 normal, 1 scene group (affects the animation timeline). |
Layer pixel data blocks
| Key | Contents |
|---|---|
Layr | Layer info, laid out as in layers and masks. |
Lr16 | Layer info of a 16-bit document. |
Lr32 | Layer info of a 32-bit document. |
PxSc | Pixel source information (CC): 4-byte version (16), descriptor. |
PxSD | Pixel source data for 3D or video layers (CC 2015): 8-byte length, then raw data (not documented). |
Patterns
Patt, Pat2 and Pat3 hold lists of patterns, each
starting with its own 4-byte length. shpa (Photoshop 6.0) holds pattern
data: a 4-byte version (0) and a 4-byte count of sets; each set is a 4-byte signature,
a 4-byte key, a 4-byte pattern count, a copy-on-sheet-duplication byte and 3 padding
bytes, then for each pattern a 4-byte colour handling (conv prefer
conversion, avod avoid conversion, lumi luminance only), a
Pascal string name, a Unicode string name and a Pascal string unique ID. Each pattern
in Patt:
| Size | Type | Name | Description |
|---|---|---|---|
| 4 | u32 | Length | Length of this pattern. |
| 4 | u32 | Version | 1. |
| 4 | u32 | Mode | Image mode, with the colour mode values of the file header. |
| 4 | s16[2] | Point | Vertical, then horizontal. |
| varies | Unicode string | Name | Pattern name. |
| varies | Pascal string | ID | Unique ID. |
| 768 | u8[256 × 3] | ColorTable | Only for indexed mode: 256 RGB colours. |
| varies | Data | Virtual memory array list, below. |
The virtual memory array list is a 4-byte version (3), a 4-byte length, a 16-byte
rectangle and a 4-byte channel count. Then for each channel, plus a user mask and a
sheet mask: a 4-byte “written” flag (skip the rest when 0), a 4-byte length, a 4-byte
pixel depth, a 16-byte rectangle, a 2-byte pixel depth, a 1-byte compression mode
and the data. The specification says “1 is zip”; psd-tools and ag-psd both read 1 as
PackBits (rows of a 2-byte count, then the packed row) and 0 as raw, and the explorer does the
same, taking 2 as ZIP and 3 as ZIP with prediction. The colour channels come first, then the
transparency. When the colour mode is indexed, some writers put 4 more bytes between the colour table and the
list (psd-tools writes zeros; ag-psd skips them when the next 4 bytes are not the version 3). The explorer
decodes each pattern into a picture (Show on the pattern’s node), and does the same for the image inside a
filter effect (FEid, FXid, FELS: a 2-byte compression code starts each array, and the
effect’s rectangle gives its size); every decoded array equals psd-tools’ in the test corpus.
Gradient settings (grdm)
| Size | Name | Description |
|---|---|---|
| 2 | Version | 1. |
| 1 | Reversed | Boolean. |
| 1 | Dithered | Boolean. |
| varies | Name | Unicode string, padded. |
| 2 | ColorStopCount | Then for each stop: location 4, midpoint 4, mode 2, colour 8. |
| 2 | TransparencyStopCount | Then for each stop: location 4, midpoint 4, opacity 2. |
| 2 | ExpansionCount | 2. |
| 2 | Interpolation | Smoothness. |
| 2 | Length | 32. |
| 2 | Mode | Gradient mode. |
| 4 | RandomSeed | Seed for noise gradients. |
| 2 | ShowTransparency | Flag. |
| 2 | UseVectorColor | Flag. |
| 4 | Roughness | Roughness factor. |
| 2 | ColorModel | Colour model. |
| 8 | Minimum | Four 2-byte minimum colour values. |
| 8 | Maximum | Four 2-byte maximum colour values. |
| 2 | Dummy | Not used. |
Placed layers and smart objects
| Key | Contents |
|---|---|
plLd, PlLd | Placed layer (files carry the key with either capital), replaced by SoLd in CS3: type plcL 4, version 4 (3), unique ID (Pascal string), page number 4, total pages 4, anti-alias policy 4, placed layer type 4 (0 unknown, 1 vector, 2 raster, 3 image stack), transform 64 (eight doubles: x and y of each corner), warp version 4 (0), descriptor version 4 (16), warp descriptor. |
SoLd | Placed layer data (CS3): identifier soLD 4, version 4 (4), descriptor version 4 (16), descriptor. |
SoLE | Smart object layer data (CC 2015): type soLD 4, version 4 (4 or 5), descriptor. |
lnkD, lnk2, lnk3 | Linked files of smart objects, each one a record of the shape below. |
Linked file record
| Size | Type | Name | Description |
|---|---|---|---|
| 8 | u64 | Length | Length of the record. |
| 4 | char[4] | Type | liFD data embedded, liFE external file, liFA alias. |
| 4 | u32 | Version | 1 to 7. |
| varies | Pascal string | ID | Unique ID, which SoLd refers to. |
| varies | Unicode string | FileName | Original file name. |
| 4 | char[4] | FileType | File type. |
| 4 | char[4] | Creator | File creator. |
| 8 | u64 | DataLength | Length of the data that follows. |
| 1 | bool | HasOpenDescriptor | If set, a descriptor version and the open-file descriptor follow. |
| varies | … | liFE: a linked-file descriptor; from version 4 the date (year 4, month 1, day 1, hour 1, minute 1, seconds as a double 8); an 8-byte file size; and the file’s bytes. liFA: 8 zero bytes. liFD: the embedded file’s bytes. | |
| varies | Unicode string | ChildDocumentID | Version 5 and later. |
| 8 | f64 | AssetModTime | Version 6 and later. |
| 1 | u8 | AssetLocked | Version 7 and later. |
Annotations (Anno)
A 2-byte major version (2), a 2-byte minor version (1) and a 4-byte count, then each annotation:
| Size | Name | Description |
|---|---|---|
| 4 | Length | Length of this annotation. |
| 4 | Type | txtA text, sndA sound. |
| 1 | Open | Whether the note is open. |
| 1 | Flags | Flags. |
| 2 | OptionalBlocks | 1 in Photoshop 6.0. |
| 16 | IconRect | Top, left, bottom, right of the icon. |
| 16 | PopupRect | Top, left, bottom, right of the pop-up. |
| 10 | Color | Colour. |
| varies | Author, Name, ModDate | Three Pascal strings, each padded to an even length. |
| 4 | DataBlockLength | Length of the next three fields. |
| 4 | DataKey | txtC text, sndM sound. |
| 4 | DataLength | Length of the data. |
| varies | Data | The text (ASCII or Unicode) or the sound, padded to a multiple of 4. |