Stabilize Mask
Cheap insurance against a mask that's 0.9999 instead of 1.0
- mask
- mask
The most boring-sounding node in the pack, and also one of the more genuinely useful ones once you've been bitten by what it fixes. It solves a numerical edge case that's easy to never notice until it silently breaks a workflow: a mask value of 0.9999999 looks like fully opaque to your eyes on a preview, but several places in ComfyUI only treat a noise mask as opaque when it's exactly ≥ 1.0. Blur, grow, and other mask math operations can leave you with values that are close to 1.0 but never quite land on it - and that tiny gap is enough to make masking behave incorrectly.
What it actually does
It maps mask values that are very close to 1.0 to be exactly 1.0. That's the entire operation. Nothing changes for genuinely mid-range mask values (a soft 0.5 feather stays 0.5) - this is specifically about snapping the already-nearly-solid parts of your mask to be solid, not about reshaping the mask's gradient.
Inputs and outputs
- mask - the mask to clean up.
- epsilon (FLOAT, default 0.01, 0–1) - the tolerance. Any value within
epsilonof 1.0 gets snapped exactly to 1.0. The 0.01 default is a sensible starting point; you're unlikely to need to touch it.
Output is a single mask, same shape, ready to use downstream exactly like the input.
Installing it
Same pack, same install as everything else here - ComfyUI Manager (search "ComfyUI Inpaint Nodes"), or manually:
cd ComfyUI/custom_nodes
git clone https://github.com/Acly/comfyui-inpaint-nodes.git
Restart ComfyUI. No model download - this is pure math on the mask tensor.
Common issues
When to actually use this one. It's cheap insurance to place right before a mask reaches a noise mask input (as opposed to a straightforward alpha composite), particularly after the mask has gone through blur or feathering operations - Expand Mask or Shrink Mask in this same pack, for instance, both have blur parameters that can leave near-1.0 values in what should be the solid interior of the mask.
How you'd notice the bug this fixes without it. The symptom is subtle: a mask that visually looks fully painted in an area, but part of the original image bleeds through in the final result as if it weren't fully masked at all. If you've ruled out denoise settings and mask painting as the cause and you're still seeing ghost content from the original image poking through a supposedly solid mask region, this is worth trying.
It won't fix a genuinely soft or wrong mask. This node only cleans up numerical noise near 1.0 - it has nothing to say about mid-gradient feathering being too aggressive or a mask being painted in the wrong place to begin with.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| mask | MASK | — | |
| epsilon | FLOAT | 0.01000–1 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| mask | MASK | — |