Nodes/ComfyUI-Beyond_nodes/🦾 Compositor Masks Output V4 🦾
ComfyUI Node

🦾 Compositor Masks Output V4 🦾

Unpack the Compositor's eight layers into images and masks

By beyondprompting·Created 9 months ago·Updated 7 months ago· 0
🦾 Compositor Masks Output V4 🦾
  • 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

Compositor Masks Output V4 takes the layer_outputs bundle from the Compositor V4 canvas and unpacks it into eight individual images and eight individual masks. Instead of one giant packed output you can't grab a layer from, you get image_1 through image_8 and mask_1 through mask_8 as normal sockets you can wire anywhere.

This is the "you asked for it" node. The README's V3.1.5 changelog literally says mask outputs were a requested feature, and the pattern carried into V4: the Compositor's layer output is deliberately kept as one bundle to keep the canvas node's interface clean, and this companion node is where you crack it open.

How it works

The Compositor V4 renders each layer - positioned, scaled, rotated, with visibility and mask applied - and stashes the results in layer_outputs, a dict that includes the eight images, eight masks, and the canvas dimensions. This node reads that dict and returns them as a flat tuple of sixteen outputs, filling any missing layers with a black image or a white mask so you always get all sixteen sockets filled (white mask = fully transparent, so an empty layer doesn't accidentally cover anything).

Since layers are numbered by input slot, mask_1 corresponds to whatever you put in image1 on the config node, and so on. That mapping is the thing to remember when you're trying to figure out which mask goes with which subject.

The inputs that matter

  • layer_outputs (required) - the COMPOSITOR_OUTPUT_MASKS output from the Compositor V4 node. Nothing else works here.

Outputs: image_1image_8 (IMAGE) and mask_1mask_8 (MASK).

Install

Part of ComfyUI-Beyond_nodes. ComfyUI Manager → search "Beyond_nodes" → install → restart. Manual:

cd ComfyUI/custom_nodes
git clone https://github.com/beyondprompting/ComfyUI-Beyond_nodes

Restart. Because this sits behind the V4 compositor, it also needs a recent ComfyUI (the V4 nodes use the newer extension API).

Common issues

  • All the masks are blank. Check that layers are actually visible in the compositor - hidden layers are skipped and come out as empty white masks.
  • The mask looks inverted from what I expect. The compositor's mask convention (and the config's invertMask toggle) is a known source of confusion. If your composited result is backwards, flip invertMask on the config node and re-run.
  • Which image is which? Outputs map to input slots 1–8 in order. Keep a note of what you connected to which slot, or you'll be guessing.
  • I just want the flattened scene. Then don't use this node - grab the Compositor's image output instead. This node is for when you need the pieces.

It's a plumbing node, pure and simple: sixteen sockets out of one bundle. If you're compositing a scene and then want to inpaint just one layer, or feed a single subject's mask to a conditioning, this is the node that makes it a two-wire job.

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