Add Noise to Mask Regions
Deliberately messing up a mask on purpose
- masks
- MASKS
Most of the masking nodes in this pack exist to clean a mask up - smooth it, threshold it, sharpen it. SaltMaskNoiseAddition does the opposite on purpose. It adds Gaussian noise to a mask's values, and there are real reasons you'd want that.
What it does
The node takes masks and perturbs every pixel value with random noise drawn from a Gaussian distribution, controlled by two optional parameters: mean (default 0, range -255 to 255) shifts the whole mask brighter or darker before the noise is applied, and stddev (default 25, range 0–100) controls how much randomness gets added around that mean - higher stddev means rougher, grainier noise. The single output is the noised MASKS.
Why you'd actually use this
A mask that's too geometrically perfect - a clean CLIPSeg blob, a hand-drawn ellipse - can produce a composite that reads as obviously synthetic, because real edges in photography are never that smooth. A light pass of noise on the mask breaks up that mechanical cleanliness before you use it for a blend or an inpaint boundary, giving the seam a more organic, less "pasted-on" look. It's also handy if you're generating training or test data and deliberately want imperfect masks to augment a dataset rather than a batch of identical, too-clean ones.
Installing it
ComfyUI Manager: search SaltAI-Open-Resources. Or by hand:
cd ComfyUI/custom_nodes
git clone https://github.com/get-salt-AI/SaltAI
Restart ComfyUI. No models, no extra dependencies for this one - it's straightforward numerical noise generation.
Common issues
The main trap is overdoing it. Push stddev too high and your mask stops being a mask and starts being static - you'll lose the actual shape you were trying to preserve, and downstream nodes that expect a coherent region (an inpaint crop, a threshold step) will behave unpredictably on speckled garbage. If you want texture without losing the underlying shape, keep stddev modest and follow this node with SaltMaskSmoothRegion - a light blur after the noise softens the speckle back into something coherent while keeping the edge irregularity you were going for. And remember mean isn't neutral: push it too far off zero and you risk clipping the whole mask toward fully-black or fully-white before the noise even gets a chance to do anything interesting, since mask values only have room to move between 0 and 1 (or 0–255, depending on how your graph represents it) either way.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| masks | MASK | — | |
| meanopt | FLOAT | 0.0-255–255 | — |
| stddevopt | FLOAT | 25.00–100 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| MASKS | MASK | — |