🦾 Compositor Masks Output V4 🦾
Unpack the Compositor's eight layers into images and masks
- 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_1–image_8 (IMAGE) and mask_1–mask_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
invertMasktoggle) is a known source of confusion. If your composited result is backwards, flipinvertMaskon 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
imageoutput 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.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| layer_outputs | COMPOSITOR_OUTPUT_MASKS | — |
Outputs (16)
| Name | Type | Description |
|---|---|---|
| image_1 | IMAGE | — |
| image_2 | IMAGE | — |
| image_3 | IMAGE | — |
| image_4 | IMAGE | — |
| image_5 | IMAGE | — |
| image_6 | IMAGE | — |
| image_7 | IMAGE | — |
| image_8 | IMAGE | — |
| mask_1 | MASK | — |
| mask_2 | MASK | — |
| mask_3 | MASK | — |
| mask_4 | MASK | — |
| mask_5 | MASK | — |
| mask_6 | MASK | — |
| mask_7 | MASK | — |
| mask_8 | MASK | — |