Nodes/WAS Node Suite v3/Layers to Image Batch
ComfyUI Node Runs on cloud

Layers to Image Batch

Take a stack apart so you can filter it

By WASasquatch·Created 3 years ago·Updated 4 days ago· 1,844
Layers to Image Batch
  • layers
  • images
  • masks
  • bounds
  • names
  • count
placement
hidden_layersfalse

Create Layered Image flattens a stack into one picture. That's the problem this node solves: it takes a stack apart - one frame per layer, its coverage as a mask, where it sits as bounds, and its name - so you can run the individual layers through the rest of ComfyUI, which only speaks images, batches and masks. It's the exit door from the LAYERS world, and its counterpart Layers from Image Batch is the door back in. Together they make the layer stack addressable by every filter, sampler and upscaler you already own.

What comes out

Five outputs, each in the same order (lowest layer in the stack first):

  • images - one frame per layer, drawn at the size, angle and flip the layer carries. A layer holding a batch answers one frame per picture.
  • masks - what each layer covers, white where it paints. A layer with no mask of its own covers its whole rectangle.
  • bounds - where each layer sits on the canvas, one row per layer, for Bounded Image Crop, Bounds to Mask or Draw Image Bounds.
  • names - what the compositor calls each layer, in order.
  • count - how many frames came out.

The bounds output is the part that makes round-trips lossless: hold onto it, and Layers from Image Batch will put every processed frame back at its exact original position.

The two placement modes

placement decides what the frames look like:

  • on the canvas - every layer padded out to the document's canvas at the position it sits. Frames line up, so you can recombine them or overlay them and everything registers. This is the mode for "recreate the composite from parts."
  • at its own size - each layer cropped to its own pixels. This is the mode for sending one layer through a filter without paying for canvas-sized padding, and it's what you want when the destination is per-layer processing.

hidden_layers controls whether layers the compositor has switched off are read at all. Off (default) skips them, which matches what Create Layered Image draws; turn it on to read the whole document, hidden layers included. If you want a throwaway guide layer to not pollute a per-layer batch, leave it off and hide the guide.

Installing it

Part of WAS Node Suite:

cd ComfyUI/custom_nodes
git clone https://github.com/WASasquatch/was-node-suite-comfyui.git

or ComfyUI Manager → "WAS Node Suite v3", restart. Requires ComfyUI 0.14.0+ and Python 3.10+; no pip packages in v3.

Where people trip

The ordering convention is everything downstream: frames come lowest-first, so batch index 0 is the bottom layer. A filter that preserves order is fine; anything that sorts or randomizes the batch will scramble your stack on the way back in - when that happens, re-sort by the names array before rebuilding. And at its own size means each frame is a different resolution; most ComfyUI filters handle that fine one frame at a time, but anything batching across frames wants on the canvas so dimensions agree.

CategoryWAS Suite/Image/Process

Inputs (3)

NameTypeDefaultDescription
layersLAYERSThe stack to read. Wire in Add Layer, Layers From Bounding Boxes or anything else answering a LAYERS document.
placementCOMBO`on the canvas` pads every layer out to the document's canvas at the position it sits, so the frames line up and can be recombined; `at its own size` crops each to its own pixels, which suits sending one layer through a filter.
hidden_layersBOOLEANfalseWhether a layer the compositor has switched off is read too. `off` skips it, which matches what Create Layered Image draws; `on` reads the whole document.

Outputs (5)

NameTypeDescription
imagesIMAGEOne frame per picture, lowest in the stack first, drawn at the size, angle and flip the layer carries. A layer holding a batch answers one frame per picture.
masksMASKWhat each layer covers, white where it paints. A layer with no mask of its own covers its whole rectangle.
boundsIMAGE_BOUNDSWhere each layer sits on the canvas, one row per layer, for Bounded Image Crop, Bounds to Mask or Draw Image Bounds.
namesARRAYWhat the compositor calls each layer, in the same order.
countINTHow many frames came out, for a switch that handles none.