Nodes/Comfyui-ergouzi-Nodes/2🐕Mask slider extension
ComfyUI Node

2🐕Mask slider extension

Grow or shrink a mask with one signed slider

By 11dogzi·Created 2 years ago·Updated 2 years ago· 102
2🐕Mask slider extension
  • mask
  • mask
extend_size0

Padding a mask before you inpaint is one of the oldest tricks in the book - give the model a little extra room around the region you actually care about, and the fix blends instead of hard-cutting at the exact edge you painted. Most nodes that do this (ComfyUI's own inpaint encoder included) bury the option as one fixed-direction parameter buried inside a bigger node. This one pulls it out as its own standalone control, so you can drop it anywhere in a mask chain regardless of what's encoding or sampling downstream.

How it works

One mask goes in, one comes out, adjusted by extend_size. Positive values grow the mask outward - dilate it, giving the region more surrounding context. Negative values shrink it inward - erode it, pulling the edit boundary tighter than what was originally painted. It's the same underlying idea as the grow_mask_by parameter you'll find baked into inpaint-encoding nodes, just exposed as its own slider that swings both directions instead of only ever growing.

The inputs and outputs that matter

  • mask (MASK, required) - the mask to adjust.
  • extend_size (INT, -1000 to 1000, default 0) - positive grows, negative shrinks, 0 is a no-op.

Output is a single mask (MASK), ready to feed straight into whatever's next - an inpaint encoder, a composite step, another mask node.

How to install it

Search Comfyui-ergouzi-Nodes in ComfyUI Manager, or clone it manually:

cd ComfyUI/custom_nodes
git clone https://github.com/11dogzi/Comfyui-ergouzi-Nodes.git

Restart ComfyUI. Standard note for this pack: the English repo is marked as no longer updated in the README, with ongoing work happening on a Chinese-named sibling instead.

Common issues & troubleshooting

Default does nothing - that's intentional. extend_size defaults to 0, so it's safe to leave this node wired inline as a permanent step; it only does work once you actually move the slider off zero.

Cranking it toward the extremes wrecks the mask. ±1000 on anything short of a huge image will either swallow the whole frame (growing) or erase the mask entirely (shrinking). Start small - the general guidance for padding around a detail fix like a face or hand is 32-64 pixels, not four digits - and nudge up from there rather than testing the far end of the range first.

Grown too far and now the edit bleeds past where you wanted it. That's the tradeoff with dilation: more padding means more surrounding context for the model, but also more of the original image getting swept into the region that's allowed to change. If you're seeing the fix spill past its intended boundary, back the value down rather than compensating with a lower denoise elsewhere.

This isn't the same as blurring the edge. Growing or shrinking moves the hard boundary of the mask; it doesn't soften it. If your seam problem is really about a sharp edge rather than the mask being too tight or too loose, you want a feather/blur node instead of this one.

Category2🐕/⛱️Mask

Inputs (2)

NameTypeDefaultDescription
maskMASK
extend_sizeINT0-1000–1000

Outputs (1)

NameTypeDescription
maskMASK