Nodes/opencv-comfyui/OpenCV GaussianBlur_0
ComfyUI Node

OpenCV GaussianBlur_0

A proper Gaussian blur without touching the diffusion model

By geroldmeisinger·Created about a year ago·Updated about a year ago· 35
OpenCV GaussianBlur_0
  • src
  • dst
  • nparray
ksize
sigmaX
sigmaY
borderType
hint

A Gaussian blur smears everything, edges included. That sounds like a downside until you realize it's the point: it's the workhorse of the post-processing layer. You use it to soften a frame, to build a bloom/glow pass (blur a bright copy and screen it back over the original), or as the reference image for an unsharp mask. It's also the exact operation that an "AI look" killer like film grain is not - this is the plain, deterministic, buy-it-for-a-millisecond primitive, and GaussianBlur_0 wraps OpenCV's implementation for ComfyUI.

Here's the take: you probably already have a Gaussian blur in some friendlier pack (spacepxl's Blur Image (Fast) is literally an OpenCV Gaussian with a better UI). So why this one? Because this is the raw cv2.GaussianBlur, meaning it plays in the BGR/nparray graph: blur between other OpenCV nodes without a single round-trip through Comfy tensors. If you're doing a multi-stage OpenCV pipeline - blur, then threshold, then detect - that saves conversions and keeps things clean.

How it works

cv2.GaussianBlur convolves the image with a Gaussian kernel: the ksize gives the kernel's size (larger = stronger smearing), and sigmaX/sigmaY give the standard deviation in each direction. Two things to know: the kernel size must be odd, and if you set sigmaX = 0, OpenCV derives the sigma from the kernel size automatically, which is what most people actually want.

Inputs that matter

  • src (NPARRAY) - the image to blur (via Image2Nparray).
  • ksize (STRING) - the kernel size as a literal, [5, 5] or (5, 5). Odd and positive - [5, 5], [9, 9]. This is the string-parsed composite parameter, so exact syntax counts.
  • sigmaX (FLOAT) - the sigma in X. 0.0 = auto-derive from ksize. This is the knob you'll actually turn.
  • sigmaY (FLOAT) - the sigma in Y. 0.0 = same as sigmaX. Keep 0.0 unless you want directional blur.
  • borderType (INT) - how edges are handled; 0 (default) is fine for images.
  • hint (INT) - an OpenCL optimization hint added in OpenCV 4.11; leave 0.

Optional dst (NPARRAY) is the usual ignored out-parameter. Output is nparray, the blurred image.

Installing

Part of geroldmeisinger/opencv-comfyui. ComfyUI Manager: search "opencv-comfyui". Or:

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

Restart ComfyUI. requirements.txt installs opencv-contrib-python, numpy, and torch.

Common issues

The invalid syntax error on this node is almost always the ksize string - [5, 5] is a valid Python literal, [5,5] is too, but 5,5 alone is not (it's a tuple only if wrapped in parens). And if you pass an even ksize, OpenCV throws ksize.width and ksize.height must be odd - make it odd.

Pack-wide rules apply as ever: Image2Nparray is single-batch only, keep the BGR/RGB conversions straight (this node expects BGR nparrays), and mind the README's CV_8UC1 grayscale assertion if you feed it a single-channel array where it expects color. Blur it right and it's the most dependable two-second op in your workflow.

Categoryimage/OpenCV

Inputs (7)

NameTypeDefaultDescription
srcNPARRAY
ksizeSTRING
sigmaXFLOAT
sigmaYFLOAT
borderTypeINT
hintINT
dstoptNPARRAY

Outputs (1)

NameTypeDescription
nparrayNPARRAY