Meux Mask Fill Holes
Fill the holes your segmentation left behind
- masks
- MASKS
Masks from real sources are almost never clean. A segmentation model misses the gap between a subject's arm and torso, an alpha channel has a speckle of holes, a matte has a ring of transparent pixels in the middle of a solid region - and suddenly your inpaint mask has a weird unpainted island in it. MeuxMaskFillHoles is the two-minute fix: feed it a MASK, and every enclosed hole inside it gets filled solid. It's the only node in this pack that has any real search traffic (all five impressions of it), which tells you it's the utility people actually bump into.
How it works
The mechanism is unglamorous and exactly right: scipy's binary_fill_holes, applied to the mask after thresholding anything above zero to white. The implementation is deliberately aligned with WAS Node Suite's "Mask Fill Holes" - the pack even registers Mask Fill Holes as a compatibility alias for this node, so workflows that reference the WAS node by name will resolve here instead. That's a thoughtful move for a pack built to run imported workflows.
It handles batched masks too: pass in a batch and each frame gets filled independently, which keeps it useful in multi-image pipelines rather than forcing you to un-batch first.
Inputs and outputs
There's exactly one of each, so there's nothing to misconfigure:
masks(MASK) inMASKS(MASK) out
That's the whole node. Wire whatever mask you have in, take the solid one out.
When it's the right tool
Reach for it any time the mask needs to be a single contiguous region - inpainting, outpaint extensions where you want the boundary clean, or background removal where you want the subject silhouette filled before it hits a compositing step. It pairs naturally with the pack's MeuxMaskLoader and MeuxImageLoader: load your image, load and align the mask, fill the holes, feed the result to your inpainting sampler.
The one thing it won't do is fill open shapes. "Enclosed" is doing real work in the name - a C-shaped or U-shaped mask region is not a hole, and binary_fill_holes will leave it alone. If you're expecting a gap between two fingers to close, this isn't the node; you'd want mask dilation or a bigger segmentation pass.
Installing it
It ships in the BaiduMeux ComfyTools pack, so it's the standard clone-and-install:
cd ComfyUI/custom_nodes
git clone https://github.com/fchangjun/Baidu_Meux_ComfyTools.git
cd Baidu_Meux_ComfyTools
pip install -r requirements.txt
Restart ComfyUI. ComfyUI Manager users: search "Baidu Meux ComfyTools". Note that scipy - the one dependency this node actually needs - comes from the shared requirements file, so if you installed the pack before v1.6.0 (when scipy was added), pull and re-run the requirements or the node will fail on import. git pull in the pack directory handles the code side.
Common issues
The biggest trap is assuming the fill didn't work when it actually did exactly what you asked. If your "hole" touches the mask's edge or isn't fully enclosed, it stays. Also remember the output follows ComfyUI's mask convention - white (1.0) is the filled region - so if you're feeding this into a node that expects the opposite polarity, invert downstream. And as with everything in this pack, be aware the shared requirements install transformers and realesrgan too; if you only wanted hole-filling, that's dead weight in your environment and the usual source of dependency friction with other custom nodes.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| masks | MASK | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| MASKS | MASK | — |