Nodes/ComfyUI-StableLayers/Save Layers (RGBA)
ComfyUI Node

Save Layers (RGBA)

Save Layers (RGBA) — the save node that doesn't throw your alpha away

By tggo·Created about a month ago·Updated about a month ago· 3
Save Layers (RGBA)
  • images
  • paths
filename_prefixlayers/layer
start_index0

Here's a fun one: the whole point of Qwen-Image-Layered is that it outputs real RGBA layers, and the stock SaveImage node will happily throw the alpha channel away before it ever touches disk. It converts to RGB and saves, so every cutout you spent the GPU time generating comes back as a flat rectangle with a black background. The layer stack is gone the second you hit save.

Save Layers (RGBA) is the end of the pipeline that respects what the model actually produced - it writes numbered PNGs with alpha, and it's the node the pack's example workflow uses to show off the four decomposed layers.

How it works

It's a drop-in replacement for SaveImage aimed at batches. Each image in the input batch gets saved as its own numbered PNG - layer_00000_00.png, layer_00000_01.png, and so on - into ComfyUI's normal output/ folder. When an image has four channels it's written in RGBA mode; if a batch item somehow has no alpha (say you fed in a plain RGB composite), it falls back to RGB instead of crashing. Nothing fancy, which is exactly what you want from the last node in the graph.

Inputs and outputs

  • images - the layer batch, usually Split Layer Stack's layers output. Feed it everything and get one file per layer.
  • filename_prefix - default layers/layer, which lands the files in ComfyUI/output/layers/. You can change the subfolder and base name here.
  • start_index (optional) - offsets the per-file numbering, handy when you're saving to a sequence that has to line up with something else.

The single output is paths: a JSON string holding the full saved file paths. In the UI you mostly ignore it, but it's a gift for headless workflows - run the graph via the API and you can read the output locations straight off the last node instead of guessing.

Wiring it in

In the pack's example graph it's the final node: SplitLayerStack → Save Layers (RGBA), with the decoded layers previewing on the right as they're written. There's also a decompose_api.py script in the repo that drives the same graph headlessly and pulls the layer_*.png back down.

Installing

Part of ComfyUI-StableLayers - one install for the whole pack:

cd ComfyUI/custom_nodes
git clone https://github.com/tggo/ComfyUI-StableLayers

then restart ComfyUI (or search ComfyUI-StableLayers in ComfyUI Manager). No extra dependencies for this node.

Gotchas

You'll still be tempted to preview with a plain preview node - do that, but remember previews and SaveImage are where alpha dies. If your saved file looks like a dark rectangle in an image viewer that ignores alpha, that's the viewer, not the file: check it in something alpha-aware (or composite it) before assuming the save failed. And if you're piping the layers onward for compositing instead of disk, Split Layer Stack's alpha_masks output is the better source of mattes - this node is the point where the stack leaves ComfyUI.

CategoryStable Layers

Inputs (3)

NameTypeDefaultDescription
imagesIMAGE
filename_prefixSTRINGlayers/layer
start_indexoptINT00–64

Outputs (1)

NameTypeDescription
pathsSTRING