Nodes/c4f-wire-loom/Loom Mask Out
ComfyUI Node

Loom Mask Out

Pull the right mask out of the stream, every time

By Codes4Fun·Created 3 months ago·Updated about a month ago· 0
Loom Mask Out
  • loom
  • LOOM
  • MASK
  • exists
label

Masks look like images, behave like images, and ruin inpaint results when the wrong one reaches the sampler. Loom Mask Out is the read side of mask routing: it pulls a MASK out of the loom stream by label, so your inpainting stage always gets the mask it was meant to have.

Why you'd reach for it

Every masked stage in an edit pipeline ends with one of these. If your Loom Mask In stored a face mask under face and an object mask under object, then Loom Mask Out with the matching label hands each inpaint stage exactly the mask it needs - no confusion between two grayscale wires that look identical on the canvas. Give it a distinctive label and the loom does the disambiguation for you.

It also closes the modify-and-put-back loop: pull the mask out, feather or erode it, push the refined version back under the same label, and later stages get the improved mask. That's the stream behavior that Set/Get-style global stores can't give you - the update flows forward naturally.

How it works

Standard loom lookup:

key = f"MASK_{label}" if label else "MASK"
if key not in loom:
    return (loom, None, False)
return (loom, loom[key], loom[key] != None)

Reading doesn't remove the mask from the loom, so several inpaint stages can read the same mask.

The outputs that matter

  • MASK: the mask under that label, or None if absent.
  • exists (BOOLEAN): True when the key exists. This is the one to watch in inpaint graphs - a False here means the sampler is about to run with no mask or the wrong one.
  • LOOM: the loom, passed through unchanged.

Inputs are loom (LOOM, required) and label (string), matching the Loom Mask In that stored it.

Installing

Part of c4f-wire-loom. ComfyUI Manager → search "c4f-wire-loom" → install → restart, or:

cd ComfyUI/custom_nodes
git clone https://github.com/Codes4Fun/c4f-wire-loom

No model downloads, no extra deps.

Where it bites

Inpainting failures trace back to this node more often than you'd think. If a region comes out wrong or untouched, check exists first: a False means the label didn't match anything in the loom (typo, or the mask was stored after this node ran). A True with a wrong-looking result usually means the mask object itself is stale - it was pushed into the loom before some earlier mask-editing step, so the loom holds the old version. Push the edited mask back in and the stream fixes itself. Nodes 2.0's arrow-drag collapse quirk applies pack-wide, with the workaround shipped.

Categoryutils/route

Inputs (2)

NameTypeDefaultDescription
loomLOOM
labeloptSTRING

Outputs (3)

NameTypeDescription
LOOMLOOM
MASKMASK
existsBOOLEAN