ComfyUI Node

Grow Mask

Grow a mask without wrecking the edges you worked for

By kinorax·Created 5 months ago·Updated about a month ago· 2
Grow Mask
  • mask
  • mask
threshold0.10
region_area_scale1.00
blur_radius_scale0.50
solid_core_scale1.00

Grow Mask is the pack's answer to a boring, universal problem: your mask is too tight, and inflating it by a flat pixel count tends to chew up the soft edges you spent effort creating. This node grows a mask while keeping it a soft mask - with feathered, tapered edges - so whatever you're inpainting or compositing blends instead of showing a hard boundary.

How it works

Where most grow nodes do "dilate by N pixels, done," this one is actually adaptive. It thresholds your input mask at threshold (default 0.1), finds the connected regions, and measures their sizes. From those it works out a representative region size (weighted median), then derives a shared grow radius and blur radius from it. The region_area_scale and blur_radius_scale inputs tune those two radii up or down relative to that measured size.

Then it does the interesting bit: dilate the binary silhouette out by the grow radius, blur it to a soft halo, and apply a solid_core_scale fill to the interior. That "solid core, soft halo" shape is the useful output - a mask that's solid where it needs to be but fades out at the rim, so an inpaint pass follows the silhouette without leaving a ring artifact. The corners are tapered, too, which keeps the boxy look away.

The inputs that matter

Four floats, and you'll mostly leave three of them alone:

  • threshold (0.1) - what counts as foreground. Pixels above this define the region that gets measured and preserved as the hard core.
  • region_area_scale (1.0) - multiplies the grow radius derived from region size. Raise it to expand the halo further out.
  • blur_radius_scale (0.5) - the feather amount, log-damped against region size. This is your edge-softening dial.
  • solid_core_scale (1.0) - how solid the interior stays after blur. Push toward 2.0 for a firmer fill without inflating the silhouette.

Output is a single mask, still a soft mask in the 0.0–1.0 range. If you need a binary mask downstream, threshold it yourself - this node deliberately doesn't binarize, because the soft values are what the pack's Detailer Start and mask-overlay nodes want.

Where it fits

Typical spot: between a segmenter (SAM3 Prompt To Mask, or a segmentation pass) and the detailer or inpaint sampler. Tight mask from an automatic segmenter, grow it a touch, and suddenly the fix has room to blend. It's also the node to reach for when your mask cuts right at the subject's outline and you keep seeing a "scissors" line in results.

Installing it

Part of the ComfyUI-Info-Prompt-Toolkit pack. ComfyUI Manager - search "Info Prompt Toolkit" - or:

cd ComfyUI/custom_nodes
git clone https://github.com/kinorax/comfyui-info-prompt-toolkit.git
cd comfyui-info-prompt-toolkit
pip install -r requirements.txt

Restart ComfyUI. No model downloads needed. The pack is a small single-author project (GPL-3.0), not one of the ecosystem giants, but this node fills a niche the big packs mostly ignore: adaptive, soft-mask-preserving growth.

CategoryInfo-Prompt-Toolkit/Mask

Inputs (5)

NameTypeDefaultDescription
maskMASKSoft or binary input mask.
thresholdFLOAT0.100–1Pixels above this value define the foreground used for radius estimation and hard-core preservation.
region_area_scaleFLOAT1.001–64Area multiplier used to derive the shared grow radius from the weighted-median representative region size.
blur_radius_scaleFLOAT0.500–16Log-damped area ratio used to derive the shared blur radius from the weighted-median representative region radius.
solid_core_scaleFLOAT1.000–2Inside fill strength after blur. Higher values make the interior more solid without expanding the outer silhouette by itself.

Outputs (1)

NameTypeDescription
maskMASK