Mask Invert
Flip a mask, flip what it means
- masks
- MASKS
About as simple as WAS Node Suite gets: it inverts a mask. White becomes black, black becomes white - whatever region was previously selected is now everything except that region. That's the entire mechanism, and yet it's one of the more load-bearing utility nodes in the whole pack, because mask direction isn't standardized across node authors.
Why you actually need this
Masks in ComfyUI follow a convention - white typically means "affected" or "selected" - but different nodes and different sources (a hand-painted mask, a CLIPSeg output, a detection model, a mask you generated with WAS's own region-detection nodes) don't always agree on which way a given mask should point relative to what you actually want. You generate a mask that highlights "the subject," but the node you're about to feed it into actually wants "everything except the subject" - say, for an inpaint-the-background pass rather than inpaint-the-subject. Rather than regenerating the mask a different way, you invert the one you already have.
How it works
One input, a MASK; one output, the same mask with black and white swapped. It fits anywhere a mask is expected downstream - Set Latent Noise Mask for inpainting, another WAS mask node in a processing chain (Mask Erode Region, Mask Dilate Region, Mask Smooth Region), or Mask to Image if you want to see it.
It's a pure logical flip, not a redraw - no smoothing, no threshold adjustment, no change to the mask's edges. If your mask had soft, feathered edges going in, it'll still have soft, feathered edges coming out; only which side reads as "selected" changes. That matters because it means Mask Invert is safe to drop anywhere in a chain without worrying that it'll subtly reshape a mask you already tuned - it genuinely only does the one thing.
Installing it
Part of the full WAS Node Suite pack:
- ComfyUI Manager - search WAS Node Suite, install, restart.
- Manual -
cd ComfyUI/custom_nodes && git clone https://github.com/WASasquatch/was-node-suite-comfyui/, thenpip install -r requirements.txtfrom inside that folder, then restart ComfyUI.
Common issues
The node itself is close to foolproof - the real trap is losing track of how many times you've inverted a mask across a larger graph. Invert it twice by accident (once deliberately, once because you forgot you already did) and you're back where you started, which is a confusing thing to debug if you're not expecting it. If your graph has more than one Mask Invert node in a chain, a label or a note node saves real time later.
And the pack-wide caveat: WAS Node Suite has been unmaintained since December 2023, and "Import Failed" errors after a ComfyUI update are a real, recurring complaint tied to older pinned dependencies. Reinstalling requirements.txt inside your ComfyUI venv is the usual fix if the whole suite stops loading.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| masks | MASK | The mask to flip. A batch of masks is inverted all at once. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| MASKS | MASK | The mask with black and white swapped. Grey levels are mirrored rather than dropped, so a half-strength area stays half strength. |