Mask Fill Holes
Close the gaps a segmentation mask left behind
Automatic masks are lumpy. Run a subject through SAM, a background remover, or a threshold, and the mask you get back often has little holes punched in it - a gap where a shiny highlight fooled the segmenter, a hollow in the middle of a solid region, speckles where texture broke up the selection. Mask Fill Holes cleans that up: it fills the enclosed holes inside a mask's regions so a shape that should be solid actually is.
It's one of a whole family of mask-cleanup nodes in WAS (dilate, erode, smooth, dominant region, and friends), and it's the one you reach for when the outline is right but the interior is swiss cheese.
How it works
The node looks at each white region in the mask and floods any fully-enclosed dark pockets to white. Think of it as "if a hole is surrounded on all sides by the mask, it was probably meant to be part of the mask." Holes that touch the edge of a region - i.e. genuine concavities and the outside background - are left alone, because those aren't enclosed. So it closes interior gaps without ballooning the mask outward the way a dilate would.
That distinction matters. Dilate grows the whole boundary; fill-holes only patches interior voids. If your problem is a ragged outer edge, this isn't the node - you want smooth or dilate. If your problem is pinholes and hollow centers inside an otherwise-correct silhouette, this is exactly it.
Inputs and outputs that matter
The input is a MASK (the messy one), and the output is a MASK (the patched one). That's the node. You drop it inline between whatever produced the mask and whatever consumes it - most often a mask coming off a segmentation or background-removal step on its way into an inpaint, a composite, or an Image Blend by Mask.
Where it fits
The KB's read on masking is that "intelligent masking" (SAM, GroundingDINO) is a targeted-selection job that feeds inpainting and compositing - and those auto-generated masks are exactly the ones that come out imperfect. A typical chain is: segment the subject, fill holes so the selection is solid, maybe smooth or grow the edge a touch, then use it. It's a small node that quietly rescues masks that would otherwise leave blotches in your composite.
How to install it
ComfyUI Manager: search was-node-suite-comfyui, install, restart. Manually:
cd ComfyUI/custom_nodes
git clone https://github.com/WASasquatch/was-node-suite-comfyui
then install the pack's requirements.txt in your ComfyUI venv and restart. Mask ops here run on NumPy/SciPy-style image math that ships with the pack's requirements; no model downloads for this one.
Common issues & troubleshooting
It filled a hole I wanted to keep. Fill-holes can't read your intent - a fully-enclosed gap gets filled, full stop. If you need that gap (say, a donut shape where the hole is real), don't run this node on it, or mask that region out first.
It did nothing. Your "holes" probably aren't enclosed - they touch the region's edge, so by definition they're not interior voids. Look at the mask: a notch cut in from the side isn't a hole. For ragged edges use a smooth/erode/dilate pass instead.
The mask is inverted, so it filled the wrong thing. Masks are white-is-selected. If your subject reads as black, invert first (there's a Mask Invert in this pack) so the regions you mean are the white ones.
Whole pack won't import after a ComfyUI update. The usual WAS Node Suite story - it pins/downgrades packages for older modules and a ComfyUI update can break the import. Re-run requirements against the activated venv, or use install.bat. The suite's been maintenance-only since late 2023.
Inputs (0)
No inputs
Outputs (0)
No outputs