Nodes/opencv-comfyui/OpenCV stackBlur_0
ComfyUI Node

OpenCV stackBlur_0

Photoshop's stack blur, fast enough for big soft glows

By geroldmeisinger·Created about a year ago·Updated about a year ago· 35
OpenCV stackBlur_0
  • src
  • dst
  • nparray
ksize

If you've ever wanted a dreamy, big-radius glow and watched a Gaussian blur crawl at 50 pixels, stackBlur is the node that fixes it. It's the same filter Photoshop calls "stack blur": a near-Gaussian look, but computed in constant time regardless of how huge your kernel is. A 100-pixel stack blur costs about the same as a 5-pixel one. That's a genuinely different trade than the Gaussian you're used to, and it's why this is the blur to grab when you're building bloom passes, soft-light washes, or those smooth out-of-focus backgrounds.

Mechanically it's from OpenCV's ximgproc contribution module - a stack-based box blur approximation that's designed to be separable and incremental, so the cost doesn't scale with kernel size. The quality is a hair softer than a true Gaussian but the speed difference on big radii is dramatic, which is why the "Blur Image (Fast)" nodes in other packs reach for this exact function. In a diffusion workflow it slots in right after decoding: blur a copy, screen or soft-light it back for a bloom, or use it as the smooth reference for an unsharp-mask subtract. The post-processing layer of ComfyUI is mostly old, deterministic pixel math anyway - this is just the cheap version of the blur half.

Inputs and output. You get src (NPARRAY) and ksize - and here's the gotcha, ksize is a STRING you type as a Python literal. For a square kernel write [31, 31] (odd sizes, please; even sizes misbehave). You can also do non-square like [100, 3] for a directional smear. There's an optional dst you should ignore per the README. Output is a single nparray.

The type contract matters more than usual here: this is cv2.stackBlur from the contrib wheel, so the pack needs opencv-contrib-python, not the plain opencv-python. Most installs already have it, but if OpenCV's missing run pip install opencv-python-contrib, and if you get Cannot import name 'guidedFilter' from 'cv2.ximgproc' you've got conflicting OpenCV packages that need sorting first.

Install. ComfyUI Manager → search "opencv-comfyui", or:

cd ComfyUI/custom_nodes
git clone https://github.com/geroldmeisinger/opencv-comfyui

restart. And remember: these nodes speak NPARRAY (BGR, 0–255, uint8 numpy), not ComfyUI IMAGE. Image2Nparray in (batch_size 1 only - use ImageFromBatch(length=1) for batches), Nparrays2Image out. If you type the ksize literal wrong you'll see invalid syntax (<unknown>, line 0) - that's just the string, not a broken install. And yes, stackBlur_1 is the identical twin; they're both fine, pick one.

Categoryimage/OpenCV

Inputs (3)

NameTypeDefaultDescription
srcNPARRAY
ksizeSTRING
dstoptNPARRAY

Outputs (1)

NameTypeDescription
nparrayNPARRAY