ComfyUI Node Runs on cloud

MaskOuterBlur

Blur the outside of a mask, not the inside — the collage secret nobody ships

By bmad4ever·Created 3 years ago·Updated 9 months ago· 70
MaskOuterBlur
  • src
  • mask
  • IMAGE
kernel_size16
paste_srctrue

Every mask node blurs the masked area to feather it. This one does the opposite, and that inversion is exactly what makes it useful. It blurs everything outside the mask while leaving the masked region sharp - then, by default, pastes the original source back inside the mask. The result is a subject that stays crisp while the background around it melts into a soft, out-of-focus haze.

The author even jokes about the name in the source (great, another "funny" name; what would you call this?), which tells you this is a utility that grew out of their own collage work rather than a headline feature. It's the kind of node you don't know you need until a cutout looks like it was glued on with scissors.

How it works

Mechanically it's OpenCV under the hood: the mask is converted to grayscale, the source image's borders are extended (BORDER_REPLICATE, so edge pixels behave like neighbors instead of black bars), and an elliptical structuring kernel is swept over the masked-out area to blur it. On an NVIDIA GPU it kicks into a numba/CUDA kernel for speed; otherwise it falls back to a numpy CPU path. With paste_src on (the default), the original pixels inside the mask are then written back on top, so the inside stays untouched no matter how aggressive the outer blur gets.

The inputs that matter

  • src (IMAGE) - what you're compositing.
  • mask (IMAGE) - what's protected. Note it's an IMAGE input, not a MASK - ComfyUI masks work fine once converted.
  • kernel_size (2–150, default 16) - the blur radius, stepped in 2s. This is your main creative dial.
  • paste_src (BOOLEAN) - on by default; turn it off if you want the whole frame (inside included) to come out blurred instead.

Output is a single IMAGE.

Where you'd actually use it

The classic move is killing the hard seam in an inpaint or collage composite. The inpainting playbook is all about feathering mask edges so the generated content blends into the surrounding image - 4–12px is the usual sweet spot - and this is the sibling trick for the background side: blur what's outside the cutout so the eye has nowhere harsh to land. It's also great for stylized depth-of-field (crisp subject, blurred backdrop) without touching a depth model.

Installing it

cd ComfyUI/custom_nodes
git clone https://github.com/bmad4ever/comfyui_bmad_nodes

restart, or find comfyui_bmad_nodes in ComfyUI Manager. The CV nodes pull in OpenCV via the pack's requirements - Manager handles it. No model downloads.

The gotcha

The GPU path needs cupy and numba, which are not in the pack's requirements. If you don't have them, it quietly runs on CPU - fine for small images, but a big kernel on a large image will make you think it hung. And kernel_size grows the effective border, so extremely large values on small images can eat your frame. If the mask doesn't match the image size, the node just resizes it to fit (it prints a note when it does), so mismatched masks won't crash you - they'll just be resampled.

CategoryBmad/CV/Misc

Inputs (4)

NameTypeDefaultDescription
srcIMAGE
maskIMAGE
kernel_sizeINT162–150
paste_srcBOOLEANtrue

Outputs (1)

NameTypeDescription
IMAGEIMAGE