ComfyUI Node

Mask Relay

A pass-through for masks when Reroute won't cut it

By longgui0318·Created 2 years ago·Updated about a year ago· 1
Mask Relay
  • mask
  • MASK

"Mask Relay" is an identity node for masks: a MASK goes in, the same MASK comes out, no processing happens. It's one of five typed relays in this pack (image, mask, int, float, string), and it exists for the same reason the others do - graph organization, not image processing.

ComfyUI's built-in Reroute handles most "wire went around a corner" cases, but masks are one place a typed relay earns its keep. Mask wires get confusing fast - you'll have a mask coming out of a segmentation node, a mask coming out of LoadImage, and a mask being produced mid-graph, and it's easy to lose track of which is which. A relay gives you a labeled, visible anchor you can park in the middle of the tangle, and it keeps the wire alive while you're swapping upstream nodes around during an edit. It also survives export/import and API round-trips better than a bare Reroute in some setups, which is why converted workflows from other tools sometimes land with these in them.

How it works

The mechanism is one line: return (mask,). No copy, no conversion - the exact same tensor passes through. The value at the relay's widget reflects whatever was fed in, which makes it a handy readout too: drop one into a chain and you can see what's actually flowing through.

Inputs and output

  • mask (MASK) - any mask, ComfyUI convention (white = foreground, typically).
  • MASK - identical, unchanged.

The honest take

For a beginner this is the node you'll probably never need. Reach for it when a workflow is getting hard to read or when you keep breaking a connection during cleanup. It's a utility you pull out when the graph becomes the problem, not when the pixels are. And as with all the relays: if you're already comfortable with Reroute, there's no strong reason to install the pack for this alone.

Installing it

It's part of longgui0318/comfyui-common-util:

cd ComfyUI/custom_nodes
git clone https://github.com/longgui0318/comfyui-common-util
cd comfyui-common-util && pip install -r requirements.txt

Restart after, or install via ComfyUI Manager by searching "comfyui-common-util". requirements.txt only pins opencv-python, but the pack imports scipy, scikit-image, and PyWavelets at load - if it won't load, pip install scipy scikit-image PyWavelets and restart.

Categoryutils

Inputs (1)

NameTypeDefaultDescription
maskMASK

Outputs (1)

NameTypeDescription
MASKMASK