Compose Layers to PSD
Stack your renders into a real layered PSD, one layer per input
- layers
- image_1
- image_2
- image_3
- image_4
- image_5
- image_6
- image_7
- image_8
- image_9
- image_10
- image_11
- image_12
- image_13
- image_14
- image_15
- image_16
- image_17
- image_18
- image_19
- image_20
- image
- mask
- filename
- layers
The other half of the layered-PSD story, and the natural sibling to Load PSD. Where Load PSD turns a document into layers, Compose Layers to PSD takes a pile of images and writes them out as a genuine multi-layer, grouped .psd in ComfyUI's input folder - then, if you want, opens it in Photoshop and waits for you to edit it, exactly like Edit in Photoshop. The flat composite returns as the node's image output, so a full round trip - multiple renders in, one editable layered document in Photoshop, your manual edits back out - is one node.
How the inputs stack
The image_1 … image_20 sockets are all optional. image_1 is the bottom layer; each higher-numbered socket stacks above it, all inside one group named by group_name (default "ComfyUI Layers"). Layers keep their native resolution - never rescaled - on a shared canvas sized to the largest input. Double-click a socket to rename it, and that name becomes the layer's name in the PSD. max_layers (default 64) caps how many images become layers; anything beyond is dropped from the end rather than growing the document forever.
There's also an optional layers (LAYERS) input - from Load PSD, core's layer nodes, or a layer-splitting model - and it's written out as real PSD layers: names, absolute positions, opacity, blend mode, and visibility all land as live, editable properties. Rotation, flips, and display size get baked into the pixels (PSD has no non-destructive transforms), with a log line per bake. Stack layers sit below any connected image_N inputs, and max_layers counts the combined total.
What comes out
image- the flattened composite (or your saved edit, once one arrives). Previewed with simple alpha blending; the PSD in Photoshop is the authoritative render.mask- marks any canvas area no layer covers (1.0 = uncovered).filename- the written PSD's name relative to the input folder. Feed it straight into a Load PSDpsdwidget to chain the two.layers- one image per layer at its real position on the shared canvas, for a Preview node.
The mode widget mirrors Edit in Photoshop: Wait for first save opens the PSD and blocks until you save, Re-run on every save re-queues per save, Don't open (composite only) just writes the file - and even then, the node shows a Written: <filename> line with a Copy Path button and right-click Open in Photoshop. existing_psd_path is the interesting one: point it at a PSD (or name a new one via Browse) and each run appends as a new numbered group into that one review document instead of writing a fresh file every time. Writes are atomic, so a failed run can't truncate a document you've been collecting into.
Install & notes
Standard pack install (Manager → Install via Git URL, or clone + pip install -r requirements.txt with ComfyUI's own Python, restart). No Photoshop or plugin needed just to write the PSD - only the open-and-edit modes involve Photoshop, and those work via the file watch without the plugin. Pre-1.0, actively developed. Two honesty notes to keep in mind: 24 of Photoshop's 27 blend modes map 1:1 by name (dissolve, darker-color, lighter-color fall back to nearest, logged), and if you append to an existing target it must be RGB - a non-RGB target is refused rather than silently converted.
Inputs (27)
| Name | Type | Default | Description |
|---|---|---|---|
| group_name | STRING | ComfyUI Layers | Name of the group every input's layer is placed inside, in the written PSD. |
| layer_names | STRING | Auto-filled by renaming an image input's socket (double-click it) -- the JSON list of custom layer names. Not meant to be edited by hand. | |
| mode | COMBO | Wait for first save | How this node treats Photoshop after writing the PSD. 'Wait for first save' opens Photoshop and pauses the workflow until you save, then returns your edited composite. 'Re-run on every save' opens Photoshop once and re-queues the workflow automatically each time you save. 'Don't open (composite only)' just writes the file and returns the flattened composite -- Photoshop never opens. |
| timeout_seconds | INT | 180010–86400 | How long to wait for you to save in Photoshop before giving up and stopping the workflow, in seconds. Only used by 'Wait for first save'. |
| max_layers | INT | 641–512 | Maximum number of images that become layers. Images beyond this cap are dropped from the end (the first images/frames are kept) rather than growing the document without limit. |
| existing_psd_path | STRING | Optional path to an existing .psd/.psb file. When set, this run's layers are appended to that file as a new group instead of writing a fresh numbered file -- use Browse to pick one, or point at a path that doesn't exist yet to create it. Leave blank to always write a new file. | |
| layersopt | LAYERS | Optional layer stack (LAYERS) -- from this pack's Load PSD node or ComfyUI 0.31+'s layer nodes (Add Layer, Create Layered Image, or a layer-splitting model). Every layer is written into the PSD with its own name, position, opacity, blend mode, and visibility, below any connected image inputs. Rotation, flips, and display size are baked into the pixels (PSD has no non-destructive transforms). The node's image output previews the result with simple alpha blending -- open the PSD in Photoshop for the authoritative render. | |
| image_1opt | IMAGE | One image layer. image_1 is the bottom layer; each higher-numbered socket stacks above it. Double-click the socket to rename it -- that name becomes the layer's name in the written PSD. | |
| image_2opt | IMAGE | One image layer. image_1 is the bottom layer; each higher-numbered socket stacks above it. Double-click the socket to rename it -- that name becomes the layer's name in the written PSD. | |
| image_3opt | IMAGE | One image layer. image_1 is the bottom layer; each higher-numbered socket stacks above it. Double-click the socket to rename it -- that name becomes the layer's name in the written PSD. | |
| image_4opt | IMAGE | One image layer. image_1 is the bottom layer; each higher-numbered socket stacks above it. Double-click the socket to rename it -- that name becomes the layer's name in the written PSD. | |
| image_5opt | IMAGE | One image layer. image_1 is the bottom layer; each higher-numbered socket stacks above it. Double-click the socket to rename it -- that name becomes the layer's name in the written PSD. | |
| image_6opt | IMAGE | One image layer. image_1 is the bottom layer; each higher-numbered socket stacks above it. Double-click the socket to rename it -- that name becomes the layer's name in the written PSD. | |
| image_7opt | IMAGE | One image layer. image_1 is the bottom layer; each higher-numbered socket stacks above it. Double-click the socket to rename it -- that name becomes the layer's name in the written PSD. | |
| image_8opt | IMAGE | One image layer. image_1 is the bottom layer; each higher-numbered socket stacks above it. Double-click the socket to rename it -- that name becomes the layer's name in the written PSD. | |
| image_9opt | IMAGE | One image layer. image_1 is the bottom layer; each higher-numbered socket stacks above it. Double-click the socket to rename it -- that name becomes the layer's name in the written PSD. | |
| image_10opt | IMAGE | One image layer. image_1 is the bottom layer; each higher-numbered socket stacks above it. Double-click the socket to rename it -- that name becomes the layer's name in the written PSD. | |
| image_11opt | IMAGE | One image layer. image_1 is the bottom layer; each higher-numbered socket stacks above it. Double-click the socket to rename it -- that name becomes the layer's name in the written PSD. | |
| image_12opt | IMAGE | One image layer. image_1 is the bottom layer; each higher-numbered socket stacks above it. Double-click the socket to rename it -- that name becomes the layer's name in the written PSD. | |
| image_13opt | IMAGE | One image layer. image_1 is the bottom layer; each higher-numbered socket stacks above it. Double-click the socket to rename it -- that name becomes the layer's name in the written PSD. | |
| image_14opt | IMAGE | One image layer. image_1 is the bottom layer; each higher-numbered socket stacks above it. Double-click the socket to rename it -- that name becomes the layer's name in the written PSD. | |
| image_15opt | IMAGE | One image layer. image_1 is the bottom layer; each higher-numbered socket stacks above it. Double-click the socket to rename it -- that name becomes the layer's name in the written PSD. | |
| image_16opt | IMAGE | One image layer. image_1 is the bottom layer; each higher-numbered socket stacks above it. Double-click the socket to rename it -- that name becomes the layer's name in the written PSD. | |
| image_17opt | IMAGE | One image layer. image_1 is the bottom layer; each higher-numbered socket stacks above it. Double-click the socket to rename it -- that name becomes the layer's name in the written PSD. | |
| image_18opt | IMAGE | One image layer. image_1 is the bottom layer; each higher-numbered socket stacks above it. Double-click the socket to rename it -- that name becomes the layer's name in the written PSD. | |
| image_19opt | IMAGE | One image layer. image_1 is the bottom layer; each higher-numbered socket stacks above it. Double-click the socket to rename it -- that name becomes the layer's name in the written PSD. | |
| image_20opt | IMAGE | One image layer. image_1 is the bottom layer; each higher-numbered socket stacks above it. Double-click the socket to rename it -- that name becomes the layer's name in the written PSD. |
Outputs (4)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | The flattened composite of every connected layer (or your saved edit, once one arrives). |
| mask | MASK | Marks any canvas area no input layer covers (1.0 = uncovered, 0.0 = covered). |
| filename | STRING | The written PSD's filename, relative to the input folder -- feed this straight into a Load PSD node's psd widget. |
| layers | IMAGE | One image per layer, each placed at its real position on the shared canvas -- connect this batch to a Preview node to see every layer individually, since the image output only ever shows the flattened composite. |