Gradient Filter Mask Regions
Turn solid blobs into outlines
- masks
- MASKS
Most of the masking nodes in this pack help you clean up a filled-in region. SaltMaskGradientRegion does something different - it converts a solid mask into just its boundary, the outline where the region's edge is. If you've ever used a "morphological gradient" filter in OpenCV or a "find edges" pass in an image editor, this is the mask equivalent: dilate the region, erode the region, subtract one from the other, and what's left is a thin ring tracing the perimeter.
How it works
For each connected region in the mask, the node compares a slightly expanded version against a slightly shrunk version and keeps only the difference - the band of pixels that changed. The width of that band is set by kernel_size. A small kernel gives you a thin, precise outline; a larger one gives a thicker border. Note the parameter only accepts odd values - that's a structural requirement of convolution-style kernels, which need a center pixel to be symmetric.
The inputs and outputs that matter
masks(required, MASK) - the source mask. This should have actual shape to it; a mask that's already just an outline or is empty won't give you anything interesting back.kernel_size(optional, default 3, range 1–31, odd steps only) - controls outline thickness. Leave it at the default for a thin, clean edge; raise it if you want a wider band, useful if you're going to feed the result into something that needs a bit of margin to work with rather than a single-pixel line.
Output: MASKS - the outline mask, ready to wire into a ControlNet or an edge-aware compositing step, or just to inspect where a region's boundary actually falls.
How to install it
SaltMaskGradientRegion ships in get-salt-AI/SaltAI ("SaltAI-Open-Resources"), the general-purpose node grab-bag from Salt AI (getsalt.ai) - the company that launched in March 2024 to run ComfyUI workflows as hosted Discord bots and, eventually, via API.
The one thing worth knowing before you go looking for it: github.com/get-salt-AI/SaltAI 404s right now. It's dropped off the org's repo list and it's not indexed in ComfyUI Manager either, so neither a Manager search for "SaltAI-Open-Resources" nor a fresh git clone will currently find it. If it's already in your custom_nodes folder, that's not affected - it's a plain image-morphology node with no models to download and nothing that reaches out to Salt AI's own infrastructure to keep functioning.
Common issues & troubleshooting
Slider won't let you set an even kernel size. That's intentional, not a UI bug - a symmetric kernel needs an odd number of pixels so there's a defined center. If you're trying to type in 4, it'll round to the nearest valid odd value.
The outline came back empty. If your input mask is fully solid (covers the entire frame) or fully empty, there's no interior/exterior boundary for a gradient filter to find. This node needs an actual edge to trace.
The line is thinner or thicker than you expected relative to your overall mask resolution. kernel_size is a fixed pixel count, so its visual thickness scales inversely with your image resolution - a kernel_size of 3 on a 4K mask reads as a hairline; the same setting on a 512px mask is comparatively much chunkier. Adjust per-resolution rather than assuming one value works everywhere.
You actually wanted a filled shrink or expand, not just the boundary. This node discards the interior on purpose - it's an outline extractor, not a mask-grow/shrink tool. If you need the region itself made bigger or smaller (not just its edge isolated), this isn't that node; there's no separate dilate/erode node in this batch, so you'd look elsewhere in the pack or in a general-purpose mask-ops node for that.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| masks | MASK | — | |
| kernel_sizeopt | INT | 31–31 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| MASKS | MASK | — |