Mask Processor
Dilate, erode, and feather — with a live preview that doesn't burn a generation
- mask
- MASK
MaskProcessor is the node you reach for when a mask from SAM, a segmenter, or manual painting is almost right - edges a hair too tight for a clean inpaint, or so sharp that the composite will show a seam. It does the two mask surgeries that fix most of those problems: dilate_erode grows or shrinks the mask, and feather softens its edges with a Gaussian blur. Output is a MASK you can feed straight back into inpainting or compositing.
The math is straightforward and it's the good kind of straightforward. dilate_erode is an integer from −100 to 100 - positive dilates (expands the white region), negative erodes (shrinks it), and it uses a morphological ellipse kernel sized to the value, so the growth is even rather than blocky. feather blurs the mask edges by a radius up to 100. Both are zero by default, so the node is a pass-through until you ask it to work.
Here's the part that makes this pack interesting, and it's worth understanding once because it applies to most WtlNodes: the apply_type dropdown. Three modes:
none- pauses the workflow per image in the batch, shows a live RAM preview, and waits for you to hit Apply or Skip in the browser. Sliders update the preview in real time.auto_apply- just runs with the current widget values, no pausing, no preview loop.apply_all- pauses once for the whole batch, shows one preview, and one Apply/Skip decision applies to every image.
The trap: if you set none or apply_all and then run the workflow headless, via the API, or with the browser tab closed, the node blocks forever waiting for a click. Interactive tuning is a frontend feature - batch jobs should use auto_apply or leave the slider at its tuned value.
You also can't A/B your way through this with generations: the preview is RAM-only, so it never touches disk. That's the point - dialing in a mask shouldn't cost you six full renders to eyeball.
Install via ComfyUI Manager (search "WtlNodes") or:
cd ComfyUI/custom_nodes
git clone https://github.com/Scorpiosis0/ComfyUI-WtlNodes.git
then restart ComfyUI. The pack's declared deps are numpy, scipy, and pillow; under the hood the mask code uses OpenCV, which already ships in a standard ComfyUI environment. No model downloads.
Where people get burned: expecting feather to also smooth jagged edges inward, which it won't - feather just blurs the boundary. And forgetting the apply_type interaction above when they queue a batch. Used right, this is the "tighten or soften, see it live, commit" step that makes mask work feel surgical instead of iterative.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| mask | MASK | — | |
| dilate_erode | INT | 0-100–100 | — |
| feather | INT | 00–100 | — |
| apply_type | COMBO | 3 options: none, auto_apply, apply_all |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| MASK | MASK | — |