Nodes/comfyUI-tool-2lab/Mask Invert 蒙版反转
ComfyUI Node

Mask Invert 蒙版反转

Flip your selection — and yes, core ComfyUI already has this

By AI2lab·Created 2 years ago·Updated 2 years ago· 23
Mask Invert 蒙版反转
  • masks
  • MASKS

Mask Invert does exactly one thing: takes a mask and returns its inverse - the white regions become black and vice versa. In from the left as masks, out on the right as MASKS, and the name says it all. It's a single-purpose pixel flip with no settings to fiddle with, and that's genuinely the entire node.

When would you actually use this in a real workflow? Inpainting and regional conditioning, mostly. If you drew a mask over the thing you want to keep, inverting it gives you the region you don't want to touch. The classic case: your mask was made for "protect this area" but the node you're feeding expects "edit this area" - one invert node fixes the polarity instead of you redrawing the mask. It's also handy when you've built a mask from a face-detector or a background-remover that returns "foreground = white," and your downstream node wants "background = white."

The mechanism is dead simple: it's a per-pixel invert, no blur, no feathering, no threshold. If your mask has soft edges, the inverted mask has the same soft edges - it mirrors exactly, it doesn't clean up.

Now the honest part, and you should read this before you get excited. Core ComfyUI already ships an InvertMask node. This node does the same job under a different label. If you installed this pack just for the invert, you didn't need to. The reason it exists is that the 2lab pack bundles its own image helpers so its published workflows don't depend on every node coming from elsewhere - a real concern when a server runs your workflow and can't have twenty packs installed. So: use it if you're standardizing on the 2lab pack or publishing to its platform; otherwise save yourself a pack and reach for the built-in.

One quirk worth knowing: the input socket is named masks (plural) and the output is MASKS, but the type is plain MASK either way. It's cosmetic - the pack's naming was never its strong suit.

Installing it

Part of AI2lab/comfyUI-tool-2lab. ComfyUI Manager → search "comfyUI-tool-2lab" → install → restart, or:

cd ComfyUI/custom_nodes
git clone https://github.com/AI2lab/comfyUI-tool-2lab

Restart ComfyUI. Light requirements, no model downloads.

Common issues

Honestly, there's nothing to troubleshoot - feed it a MASK, get a MASK back. If the output looks wrong, check upstream: the invert is exact, so any weirdness in the result was in the mask before it arrived. And because there's no blur/feather built in, a hard-edged mask stays hard-edged; if you need softening, put a mask-blur node in front or behind the invert. The only "surprise" for beginners is realizing they could have used the core node - but if you're here because a downloaded workflow asks for mask_invert (2lab), now you know exactly what it does and that it's safe to run.

Category🦊2lab/image

Inputs (1)

NameTypeDefaultDescription
masksMASK

Outputs (1)

NameTypeDescription
MASKSMASK