Nodes/ComfyUI-MX-post-processing-nodes/MX_KuwaharaBlur(Cartoon)
ComfyUI Node

MX_KuwaharaBlur(Cartoon)

The blur that keeps edges crisp and flattens everything else

By Intersection98·Created 2 years ago·Updated 2 years ago· 13
MX_KuwaharaBlur(Cartoon)
  • image
  • IMAGE
blur_radius3
method

Kuwahara is the pack's "cartoon" blur - an edge-preserving filter that smooths out detail between edges while leaving the edges themselves sharp. Where a plain Gaussian blur smears everything, Kuwahara flattens flat areas into clean, painterly patches and keeps boundaries intact. That's why it's the standard first step toward that "oil painting / cel-shaded" look, and why the node's display name is MX_KuwaharaBlur(Cartoon).

It's part of Intersection98/ComfyUI-MX-post-processing-nodes, and it's the smart sibling of the pack's plain MX_Blur. If you want to de-noise a render without turning every hair into a smudge, this is the one.

How it works

The Kuwahara filter works by sampling four quadrants around each pixel - up-left, up-right, down-left, down-right - and computing the average color and the variance of each. The pixel takes the average from whichever quadrant has the lowest variance - i.e. the flattest, most uniform area. Since a real edge will have high variance across it, the filter naturally avoids averaging across boundaries and picks the region it belongs to. That's the whole magic: smoothness where there's nothing going on, preservation where there is.

The method input chooses how each quadrant is averaged:

  • mean - plain box averages. Fast, chunky, the classic cartoon look.
  • gaussian - weighted averages via Gaussian kernels. Softer transitions, more "painted," a touch heavier on compute.

And blur_radius controls the neighborhood size the filter considers; at 0 the image passes through untouched.

The inputs that matter

  • image - your IMAGE tensor.
  • blur_radius - 0 to 31, default 3. The filter window. 3–5 is the sweet spot for a visible-but-subtle flatting; crank it up and surfaces dissolve into smooth planes.
  • method - mean or gaussian. Start with mean for the strongest cartoon effect; switch to gaussian when you want the smoothness without the harsh "poster-paint" edges.

Output is a single IMAGE, same resolution.

Install

Standard MX pack install. ComfyUI Manager (search MX or ComfyUI-MX-post-processing-nodes), or:

cd ComfyUI/custom_nodes
git clone https://github.com/Intersection98/ComfyUI_MX_post_processing-nodes
cd ComfyUI_MX_post_processing-nodes
pip install -r requirements.txt

Restart ComfyUI; it sits under postprocessing/Filters. No models, no downloads - this one leans on OpenCV's separable filtering, which your install almost certainly has.

Where people get burned

The Kuwahara's famous weakness is its "oil painting" texture at large radii: because the quadrant choice can vary abruptly between neighboring pixels, big blur_radius values create patchy, stained-glass artifacts in smooth gradients (sky, skin, walls). That's not a bug - it's the filter's signature. If you see it, back the radius off or switch to gaussian. Second, it's per-frame and not trivial to compute: on high-resolution images it's noticeably slower than the pack's plain blur, so for a subtle de-noise it's often overkill versus MX_Blur at low sigma. The sweet spot is when you want the painterly flattening - run it ahead of a MX_Posterize and you've got a very credible stylized-illustration pipeline in two nodes.

Categorypostprocessing/Filters

Inputs (3)

NameTypeDefaultDescription
imageIMAGE
blur_radiusINT30–31
methodCOMBO2 options: mean, gaussian

Outputs (1)

NameTypeDescription
IMAGEIMAGE