𝙆 Mask Filler
Patch the holes in a mask before they wreck your inpaint
- mask
- MASK
If you've ever fed a mask into inpainting and gotten a weird untouched ring in the middle of your edit, this node exists for exactly that. Mask Filler takes a mask, finds any closed loop in it - the outline of a circle, a blob with a hole punched through the middle, whatever - and fills the inside solid. Everything that isn't a closed shape gets left completely alone. It's a one-trick node, and the trick is a genuinely annoying problem to fix by hand.
How it works
Under the hood it's contour detection: the node scans the mask for boundaries that form a closed loop, then fills whatever's enclosed by that loop. Think of a mask that looks like a hollow ring instead of a solid disc - maybe it came out of an edge-detector, or you painted an outline instead of a filled selection, or a mask-math step (union, subtract) left a donut shape behind. Feed that into an inpainter as-is and you'll paint a ring while the center stays untouched, which almost never looks right. Mask Filler turns the ring into a disc first.
The catch, and it follows directly from how contour-fill works: the loop actually has to be closed. If your mask outline has a gap in it - a broken line, a few missing pixels - the algorithm doesn't see a closed shape and won't fill anything. That's not a bug, it's the whole mechanism; a fill algorithm that guessed at broken boundaries would be a much less predictable node.
The inputs and outputs that matter
There's exactly one input and one output, and neither has a single knob:
mask(MASK) - whatever mask you want checked for holes.- Output: MASK - the same mask, with any closed regions filled solid.
That's the entire interface. No thresholds, no dilation amount, no mode switch. If your mask has no closed loops in it, this node is a harmless no-op - safe to leave sitting in a graph on the off chance a mask upstream develops a hole later.
How to install it
Same as the rest of the pack: open ComfyUI Manager, search KayTool, install, restart. Or clone it by hand:
cd ComfyUI/custom_nodes
git clone https://github.com/kk8bit/KayTool
then restart ComfyUI. No extra models, no Python dependencies beyond what a standard OpenCV-flavored contour-detection routine needs - this is a lightweight, self-contained pack, and Mask Filler in particular doesn't touch the network or the filesystem beyond the install step.
Common issues & troubleshooting
Nothing changed after running it. Almost always means your mask didn't actually have a closed loop to begin with - either it was already solid (nothing to fill, correctly a no-op) or the boundary you were expecting to close has a gap somewhere. Zoom in on the mask preview where you think the hole is; if the outline breaks anywhere, that's why it wasn't treated as a closed shape.
You wanted it to expand or smooth the mask, not just fill holes. This node doesn't grow or blur a mask - it strictly fills enclosed regions and leaves the rest of the shape exactly as it was. If you need mask growth or blur on top of this, that's a separate step; Mask Filler only closes what's already closed.
Beyond that there's not much to troubleshoot. One input, one output, no configuration - it's about as hard to misuse as a ComfyUI node gets, which is honestly the point of a utility node like this.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| mask | MASK | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| MASK | MASK | — |