Nodes/comfyui-fams/Selective Blur
ComfyUI Node

Selective Blur

ImageMagick's edge-preserving blur, without leaving ComfyUI

By famellad·Created 3 months ago·Updated 26 days ago· 0
Selective Blur
  • image
  • PROCESSED_IMAGE
radius15.0
sigma8.0
threshold0.250

Every so often you need to soften an image without turning it to mush. A plain Gaussian blur can't tell a face from its background - it smears both, edges included. What you actually want is an edge-preserving blur: smooth the flat regions, leave the boundaries alone. That's exactly what Selective Blur does, by wrapping ImageMagick's selective_blur through the Python wand binding.

The knobs

The mechanism is about as direct as it gets. The node converts your tensor into a wand image, calls selective_blur(radius, sigma, threshold), and converts back. The three knobs are ImageMagick's own parameters:

  • threshold is the interesting one, and it's what makes this "selective". It's a contrast threshold: pixels in low-contrast neighborhoods (flat sky, smooth wall) get blurred, while strong edges (hair, jawline, lettering) survive. Internally the node scales your 0–1 value by ImageMagick's quantum range (65535 on a standard Q16 build), so don't sweat the units - just know higher threshold means more of the image qualifies for blur, lower means only the flattest areas soften.
  • radius and sigma are the classic Gaussian pair. Sigma around half the radius keeps the falloff smooth, and big radius/sigma values cost you wall-clock time.

What do you actually use it for? Skin smoothing without the plastic look. Softening a background so the subject pops. Denoising a slightly crunchy render. The KB's post-processing essay splits blur into two jobs - smear-everything versus edge-preserving - and this is firmly the second kind, same family as a bilateral filter but with one threshold to dial instead of a pile of parameters.

The wand dependency

Now the caveat that makes this the pack's high-maintenance member: wand is a thin wrapper over the ImageMagick C library, and pip can't install that for you. On Linux:

sudo apt install libmagickwand-dev   # Debian/Ubuntu
# or: brew install imagemagick       # macOS

then pip install wand (ComfyUI Manager will do the pip half automatically when it installs the pack). On Windows you need the ImageMagick installer from imagemagick.org. And here's the gotcha that will actually trip you up: the whole comfyui-fams pack fails to load if wand is missing, because img_proc.py imports wand at the top. Install the pack and see zero Fams nodes in your menu? This dependency is why - and it drags down SimpleDepthOfField with it, even though that node never touches wand.

Where to start

Start with the defaults (radius 15, sigma 8, threshold 0.25) and adjust from there. The output is PROCESSED_IMAGE, ready for a save node or the next stage. It's a niche tool, but on the days you need selective softening, it beats stitching a bilateral blur chain together by hand.

CategoryFams/Image Processing

Inputs (4)

NameTypeDefaultDescription
imageIMAGE
radiusFLOAT15.00–2000
sigmaFLOAT8.00–2000
thresholdFLOAT0.2500–1

Outputs (1)

NameTypeDescription
PROCESSED_IMAGEIMAGE