⭐ Star PSD Saver Adv. Layers
Dynamic PSD layers that grow as you connect, plus a flattened preview
- layer1
- mask1
- flattened_image
The StarNodes PSD family has two flavors: PSD Saver 2 (Optimized) gives you a fixed ten-layer budget, and this one, Star PSD Saver Adv. Layers, gives you layers that grow as you connect them. The FlexibleLayerInputs machinery means the node starts with just layer1/mask1 sockets and expands as you plug more in - no pre-counted slots, no "I have eleven layers but the node only has ten." If your composite's layer count changes between runs, this is the one you want.
It's also the variant that gives something back: a flattened_image output, so you can preview the composite or pipe it onward while the PSD writes. You can even tell it not to write a PSD at all (save_psd off) and just use it as a flatten/composite helper - a cheap way to merge layers and masks into a single image without the file I/O.
How it works
Connect an IMAGE to layer1 and optionally a MASK to mask1, and the node opens more slots as needed. It builds a PSD with each connected image on its own layer, applies masks as layer masks, writes the file to output_dir (default PSD_Layers) under ComfyUI's output folder, and - unless save_psd is off - returns the flattened result as an image tensor.
The mechanism is worth knowing because of how it differs from the fixed-slot sibling: the FlexibleLayerInputs type is the reason sockets appear and disappear. If you're on an older ComfyUI that predates growable inputs, the node may show only the initial slots; updating ComfyUI fixes that.
Inputs and outputs
- filename_prefix (default
multilayer_adv) - output base name. - output_dir (default
PSD_Layers) - subfolder under ComfyUI's output directory. - save_psd (default
true) - set false to skip the file and just flatten. - layer1… and mask1… - the growable image and mask slots.
The single output, flattened_image (IMAGE), is the composite with masks applied.
Install
Same pack, same dependency (psd-tools is the one that matters):
cd ComfyUI/custom_nodes
git clone https://github.com/Starnodes2024/ComfyUI_StarNodes
cd ComfyUI_StarNodes
pip install -r requirements.txt
Restart, search star. If the node is missing from the menu, the console will name the package to install.
Where people get burned
The growable-slot behavior is great until it surprises you: if you remove a wire, the socket closes and your downstream wire may need re-seating. And because layers are full-canvas images positioned by their corners, mixed-size inputs won't auto-center - keep your layers the same dimensions or be ready to reposition in your editor. Finally, flattened_image respects the mask alpha, so a soft mask in means a soft edge in the preview; don't mistake that for a bug.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| filename_prefix | STRING | multilayer_adv | — |
| output_dir | STRING | PSD_Layers | — |
| save_psd | BOOLEAN | true | — |
| layer1opt | IMAGE | — | |
| mask1opt | MASK | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| flattened_image | IMAGE | — |