Nodes/ComfyUI-enricos-nodes/πŸ’œ Compositor Masks Output (V3)
ComfyUI Node

πŸ’œ Compositor Masks Output (V3)

Getting each layer and its mask back out of the canvas

By erosDiffusionΒ·Created 2 years agoΒ·Updated about a month agoΒ· 634
πŸ’œ Compositor Masks Output (V3)
  • layer_outputs
  • image_1
  • image_2
  • image_3
  • image_4
  • image_5
  • image_6
  • image_7
  • image_8
  • mask_1
  • mask_2
  • mask_3
  • mask_4
  • mask_5
  • mask_6
  • mask_7
  • mask_8

The Compositor V3 packs all 8 layers plus their masks into one COMPOSITOR_OUTPUT_MASKS socket on its layer_outputs output. That's a tidy design but useless until someone unpacks it. This node is the unpacker: feed it the layer_outputs socket and you get 16 individual outputs - image_1 through image_8 and mask_1 through mask_8 - each positioned, scaled and rotated to match exactly what's on your canvas.

This is the node that turns the Compositor from "make a picture" into "make a picture and hand every element to other nodes." It's how people split a finished composition back into separate layers for per-element controlnets, inpainting, or feeding individual subjects into an edit model. Each mask is canvas-sized, so the layers all line up when you re-stack them.

The input and outputs

One input: layer_outputs (a COMPOSITOR_OUTPUT_MASKS object) straight from the Compositor V3 node. That's it - no widgets to fiddle with.

Outputs: image_1–image_8 (IMAGE) and mask_1–mask_8 (MASK). Missing slots come back as a blank image and a fully transparent mask, so downstream nodes don't choke on empty inputs. If you only used 3 images, you still get 8 image and 8 mask outputs - the empty ones are just blank.

Installing

Same pack, same story - no models, no extra dependencies:

cd ComfyUI/custom_nodes
git clone https://github.com/erosDiffusion/ComfyUI-enricos-nodes.git

or ComfyUI Manager β†’ search "Compositor" β†’ erosDiffusion. Restart to see it.

Gotchas

There's a hidden subtract_masks option in the code that, when enabled, subtracts higher layers' masks from lower ones (so layer 5's mask doesn't include what layer 6 covers). It exists for the "stacked cutouts shouldn't overlap" use case, but the README flagged proper mask stacking as still being worked on - don't rely on it for production yet.

One V3 quirk to keep in mind: the mask convention here is ComfyUI's usual one, and whether invertMask is on in the Config node changes what these masks look like. If a mask comes out inverted relative to what you expect, flip invertMask at the config, not here. And remember this is the V3-era node - the V4 version (Compositor4MasksOutput) exists but V4 itself temporarily removed the layer_outputs output while it's in alpha, so for now this pair only truly shines with V3.

Categoryimage

Inputs (1)

NameTypeDefaultDescription
layer_outputsCOMPOSITOR_OUTPUT_MASKSβ€”

Outputs (16)

NameTypeDescription
image_1IMAGEβ€”
image_2IMAGEβ€”
image_3IMAGEβ€”
image_4IMAGEβ€”
image_5IMAGEβ€”
image_6IMAGEβ€”
image_7IMAGEβ€”
image_8IMAGEβ€”
mask_1MASKβ€”
mask_2MASKβ€”
mask_3MASKβ€”
mask_4MASKβ€”
mask_5MASKβ€”
mask_6MASKβ€”
mask_7MASKβ€”
mask_8MASKβ€”