Invert Mask Regions
Flip what's masked and what isn't
- masks
- MASKS
The simplest node in this entire filter family, and one of the most-used mask operations in any ComfyUI graph: SaltMaskInvert flips a mask so what was selected becomes unselected and vice versa. A "select the subject" mask becomes a "select the background" mask in one node. If you've built more than a couple of masking workflows, you've needed this - a segmentation model gives you the foreground, but your actual next step needs the background, or you generated a mask meant for "protect this area" when the node downstream expects "affect this area."
How it works
There's no cleverness to explain - it's arithmetic inversion. Every pixel value in the mask gets replaced with its complement: what was fully "on" becomes fully "off," what was fully "off" becomes fully "on," and anything in between (soft, partially-transparent edges) gets mirrored around the midpoint rather than snapped to a hard value. A feathered edge stays feathered after inversion; it just points the other way.
The inputs and outputs that matter
masks(required, MASK) - that's the whole input list. Nothing to configure.
Output: MASKS, the complement of what went in.
How to install it
SaltMaskInvert is part of get-salt-AI/SaltAI, published as "SaltAI-Open-Resources" by Salt AI (getsalt.ai). The company launched in March 2024 to run ComfyUI workflows as hosted Discord bots and later an API; this masking node family - along with a set of animation-scheduling nodes that take FLOAT/INT lists - was the general-purpose utility layer in the same repo, useful independent of the platform itself.
Worth knowing up front if you go looking: github.com/get-salt-AI/SaltAI currently 404s. The org page is still live with a few other repos, but this one isn't listed anymore, and it's also absent from ComfyUI Manager's node index - so neither a Manager search nor a fresh git clone will currently turn it up. That said, if this specific node is all you need, it's about as replaceable as a custom node gets: basic mask inversion is one line of code (1.0 - mask), and if you're blocked on getting SaltAI itself, most general-purpose mask packs (Impact Pack, WAS Node Suite, and others already common in a typical install) ship an equivalent invert node. If SaltAI is already in your environment, though, there's nothing else to worry about here - no model downloads, no dependency on Salt AI's own servers.
Common issues & troubleshooting
Your composite came out backwards. This is the single most common mask bug in any ComfyUI graph, and it usually isn't this node's fault - it's an invert applied at the wrong point, or one too many/too few inversions somewhere upstream. Trace the mask through your graph with a Preview Image node at each step until you find where "affect this" flipped to "protect this."
A soft-edged mask looks the same after inverting, just less obviously. Because inversion mirrors values rather than snapping them, a feathered mask stays feathered - you won't get a hard edge just because you inverted it. If you need a crisp boundary, that's a separate step (thresholding), not something inversion gives you as a side effect.
Double-inverting and wondering why nothing changed. Two inverts cancel out, which is correct behavior, not a bug - if a mask looks unchanged after passing through what you thought was one SaltMaskInvert, check whether it actually went through two somewhere in the graph.
You need to invert only part of a multi-region mask, not the whole thing. This node operates on the entire mask uniformly - it has no concept of "these regions only." If you need selective inversion, split the mask into regions first with SaltMaskRegionSplit, invert the specific output you care about, then recombine.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| masks | MASK | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| MASKS | MASK | — |