Nodes/ComfyUI-Apt_Preset/Image_smooth_blur
ComfyUI Node

Image_smooth_blur

Feather a mask edge and recolor what's outside it

By cardenluo·Created 2 years ago·Updated 18 days ago· 309
Image_smooth_blur
  • image
  • mask
  • image
  • smooth_mask
  • invert_mask
smoothness0
invert_maskfalse
mask_expansion0
mask_colorwhite
bg_colorAlpha
brightness0.00

The name undersells it a bit - this isn't a generic image blur, it's a mask-edge softener with a background swap built in. Give it an image and a mask, and it feathers the mask's hard edge into a gradient, optionally grows or shrinks the mask first, and lets you recolor both the masked region and the area outside it independently. It's the kind of node you reach for right before a composite, when a razor-sharp cutout edge would look pasted-in and you want it to blend.

How it works

Under the hood this is doing two related jobs. First, smoothness blurs the mask itself (not the image) - a small Gaussian-style falloff at the mask boundary instead of a hard 0/1 cutoff, so whatever you composite with it next fades in rather than snapping on. Second, mask_expansion grows (positive) or shrinks (negative) the mask before that softening happens, which is the usual fix when a mask is a few pixels too tight or too loose around your subject. On top of that, mask_color and bg_color let you flatten the masked region and the background to solid colors (or leave them as the original image, or pull alpha) - useful for previewing a mask's shape, or for generating a clean silhouette/matte rather than a photographic composite.

The inputs and outputs that matter

  • image / mask (required) - the pair you're working with.
  • smoothness (INT, 0–2000, default 0) - how much the mask edge gets feathered. 0 is a hard edge; push it up for a soft transition.
  • mask_expansion (INT, -50 to 50, default 0) - grow or shrink the mask before feathering.
  • invert_mask (BOOLEAN, default off) - flips which side is "inside."
  • mask_color / bg_color - what fills the masked region and the outside-mask region respectively. Both accept image (leave it as-is), Alpha (transparent), or a flat color (white/black/red/green/blue/gray). bg_color defaults to Alpha, mask_color defaults to white.
  • brightness (FLOAT, optional, 0–10, default 0) - an extra brightness adjustment on top of everything else.

Three outputs: image (the processed composite), smooth_mask (the feathered mask on its own, useful for reuse downstream), and invert_mask (the inverted version of that same feathered mask - handy when you need both sides without a separate invert node).

How to install it

ComfyUI Manager: search ComfyUI-Apt_Preset, install, restart. Manual:

cd ComfyUI/custom_nodes
git clone https://github.com/cardenluo/ComfyUI-Apt_Preset
pip install -r requirements.txt

install.bat is Windows-only; on Linux (comfy.icu included) run pip install -r requirements.txt. No model files needed - this is pure image/mask compositing.

Common issues

A smoothness value that looks fine at low resolution can look barely-there once you're working at 2K+ - the feather radius is in pixels, not a percentage of image size, so scale it up with your resolution. If the mask edge still looks hard after cranking smoothness, double-check mask_expansion isn't zero when your source mask was already tight - feathering a mask that's clipped right at the subject boundary has nothing to soften into; expand it a few pixels first.

The mask_color/bg_color combo is also easy to misread if you're expecting a straight blur: with both left at their defaults (white mask, Alpha background), you'll get a white silhouette on transparent, not the original photo with soft edges - set both to image if you want the original pixels preserved everywhere and only the mask boundary softened.

As with the rest of the pack, this node ships inside a large requirements.txt (onnxruntime, gguf, transparent-background, and more, for the pack's other 100+ nodes) that has to import cleanly for anything in ComfyUI-Apt_Preset to load. If the whole pack fails with IMPORT FAILED on a fresh install - a real, reported failure mode for this pack - check the ComfyUI console for the specific missing package before assuming this node is the problem.

CategoryApt_Preset/image

Inputs (8)

NameTypeDefaultDescription
imageIMAGE
maskMASK
smoothnessINT00–2000
invert_maskBOOLEANfalse
mask_expansionINT0-50–50
mask_colorCOMBOwhite8 options: image, Alpha, white, black, red, green, +2
bg_colorCOMBOAlpha8 options: image, Alpha, white, black, red, green, +2
brightnessoptFLOAT0.000–10

Outputs (3)

NameTypeDescription
imageIMAGE
smooth_maskMASK
invert_maskMASK