Layers to PSD
Stack your processed layers back into a real PSD, positions intact
- images
- layer_info
- psd
- flat_preview
This is the payoff node - the "conquer" half of the split-process-rebuild loop. Layers to PSD takes your processed images and the layer_info metadata that bypassed all your processing, and assembles them into an actual layered Photoshop document, then hands you both the PSD reference and a flattened preview. It's how your edited layers stop being a pile of loose images and become a file an art director can open.
The clever part is what happens when your layers changed size. Say you upscaled each layer 2×. The node compares every image against its layer_info's original width/height, computes the scale factor, and multiplies each layer's left/top position by that same factor - so everything lands where it belongs relative to the others. Then it sizes the canvas to fit: base canvas times the max scale, grown further if any layer's bounding box spills past it. It also rebuilds the group hierarchy from the group names and sibling indices stored in layer_info, so nested groups come back nested, not flattened.
The inputs that matter
- images - your processed layer images, in the same index order as the metadata.
- layer_info - the bypassed metadata from PSD to Layers. Feed it straight through; it never touched your processing.
- canvas_width / canvas_height - both default to
0, which means auto: derive the canvas from the scale factors and layer bounding boxes. Set them to force a specific canvas size instead. If you set a fixed canvas smaller than the content, layers will simply sit where the math puts them (you can end up with overflow - that's on you, not a bug).
Outputs
- psd - an in-memory
PSDreference (no file written yet). Wire it to Save PSD File, or even into Merge PSD Files. - flat_preview - the whole result composited onto a transparent background, so you can check the rebuild before committing to disk.
The gotchas, honestly
Same count-mismatch error as its siblings: images and layer_info must be one-to-one, or it refuses to run. That's the safety net that stops a dropped layer from silently reflowing your whole document.
One subtlety about auto-canvas: if you upscaled only some layers, the canvas scales by the max factor across the document, and layers that didn't grow will be smaller relative to the canvas than they were in the original - mathematically correct, visually different from the source. If the goal is "same document, but that one layer is sharper," use Apply Alpha to Layers with restore_original_scale on the way in, or pin canvas_width/canvas_height to the original document size.
Install
Pack-wide: ComfyUI Manager → ComfyUI-PSD2Layer, or clone + pip install -r requirements.txt + restart. Only psd-tools, Pillow, numpy - no weights, no GPU required. Because everything rides on psd-tools, an exotic source document (PSB, unusual smart objects) is the one place the round-trip can wobble; for a normal layered file you'll get your structure back faithfully.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| images | IMAGE | — | |
| layer_info | LAYER_INFO | — | |
| canvas_width | INT | 00–65536 | — |
| canvas_height | INT | 00–65536 | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| psd | PSD | — |
| flat_preview | IMAGE | — |