Expand Mask
Give your inpaint some breathing room
- mask
- mask
A small, unglamorous node that fixes a genuinely common inpainting mistake: masking exactly the thing you want changed, and nothing else. Grow the mask a bit past the edges of what you're actually fixing, and the model gets context and room to blend - mask too tight, and you get a visible ring where the generated pixels butt up against untouched ones.
Why the tight mask fails
If you paint a mask that hugs an object precisely - say, exactly the outline of a hand you're fixing - the sampler has to produce a seamless transition at a boundary with zero margin for error. Expanding the mask outward gives the diffusion process actual surrounding pixels to blend against instead of a hard cliff edge. This is the same idea behind the "adequate padding" advice you'll hear for only-masked inpainting generally; this node is how you actually do it in ComfyUI.
Inputs and outputs
- mask - what you're expanding.
- grow (INT, default 16, 0–8096) - how many pixels to grow the mask by. Positive values only here; this node doesn't shrink (that's Shrink Mask, the mirror-image node in this same pack).
- blur (INT, default 7, 0–8096) - feathers the mask edge after growing, for a softer transition rather than a hard new boundary.
- blur_type - a dropdown, defaulting to
gaussian.
Output is a single mask, ready to plug into your VAE encode or conditioning step.
Installing it
Comes with the rest of the pack - ComfyUI Manager (search "ComfyUI Inpaint Nodes"), or manually:
cd ComfyUI/custom_nodes
git clone https://github.com/Acly/comfyui-inpaint-nodes.git
Restart ComfyUI. No model download needed - this node is pure mask math, nothing to fetch.
Common issues
Growing too much bleeds into stuff you wanted untouched. There's a real trade-off here: more margin gives the sampler better blending context, but it also puts more of the surrounding image up for regeneration. Start small (the 16px default is a reasonable floor) and go up only if you're still seeing seams.
Blurred mask reintroducing values that aren't quite 0 or 1. After growing and blurring, mask edges end up with a gradient of in-between values by design - that's the feathering working as intended. But if you're using this mask as a noise mask (rather than for a straightforward composite), ComfyUI in a few places only treats a mask as fully opaque at exactly 1.0, and blur can leave near-1.0-but-not-quite values in the solid interior too. If that bites you, run the result through Stabilize Mask from this same pack before it hits your sampler.
No shrink option here on purpose. If you need to pull a mask inward instead of growing it - say, a segmentation mask that's a little too generous - reach for Shrink Mask, not a negative number in this one; grow's floor is 0.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| mask | MASK | — | |
| grow | INT | 160–8096 | — |
| blur | INT | 70–8096 | — |
| blur_type | COMBO | gaussian | 3 options: box, linear, gaussian |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| mask | MASK | — |