Nodes/ComfyUI-TextureAlchemy/Smart Blur (Edge-Preserving)
ComfyUI Node

Smart Blur (Edge-Preserving)

Denoising textures without smearing the detail you paid for

By amtarr·Created 9 months ago·Updated 4 months ago· 58
Smart Blur (Edge-Preserving)
  • image
  • result
radius5.0
edge_threshold0.10
iterations1

A normal Gaussian blur doesn't know a noise grain from a crack in the plaster - it eats both. Smart Blur is edge-preserving: it finds the edges first, then blurs everything except them. You get noise removal where the surface is flat and intact detail where it matters. For cleaning up scanned textures and AI-extracted maps, that distinction is the whole game.

How it works

Each pass does three things:

  1. Detect edges - converts to grayscale and runs a Sobel operator, producing an edge-strength map.
  2. Turn that into a mask - a sigmoid (edge_threshold as the cutoff) decides how strongly each pixel counts as "edge."
  3. Blur with the mask as a shield - a Gaussian blur is applied, then blended back so edge pixels keep their original values and flat areas get the smoothed result.

The knobs map cleanly onto that: radius (1–50) is the blur size in pixels; edge_threshold (0.01–0.5, default 0.1) is how sensitive the edge detection is - lower protects more edges, higher blurs through more of them; iterations (1–5) runs the whole thing again, which smooths progressively without ever quite killing the protected edges.

What to reach for it for

It's the pre-processing workhorse. Run it on a noisy scan before you make it seamless, or on an extracted roughness map that's grainier than the source material warrants. It pairs naturally with the pack's texture pipeline: denoise → equalize lighting → tile. Because it preserves edges, you can be more aggressive than you'd dare with a plain blur.

Installing it

Part of amtarr/ComfyUI-TextureAlchemy - ComfyUI Manager "Texture Alchemy", or:

cd ComfyUI/custom_nodes
git clone https://github.com/amtarr/ComfyUI-TextureAlchemy

Restart, then right-click → Add Node → Texture Alchemist → Detail. No extra dependencies, no models - it's convolutions on ComfyUI's bundled PyTorch.

The honest gotchas

Edge detection is on grayscale, so a color transition with equal brightness on both sides isn't an "edge" and will get blurred - flat-color cartoon textures can smear at hue boundaries. And edge_threshold is a real dial: leave it at the 0.1 default and crank radius and you'll still see fine details survive; push threshold to 0.4 and you've basically got a Gaussian blur with extra steps. If the output looks like it's dissolving, your threshold is too high, not your radius. The pack prints its console banner each run, which is normal. For a one-shot denoise, one iteration at radius 3–5 is usually enough; more iterations are for stubborn noise, not enthusiasm.

CategoryTexture Alchemist/Detail

Inputs (4)

NameTypeDefaultDescription
imageIMAGE
radiusFLOAT5.01–50Blur radius
edge_thresholdFLOAT0.100.01–0.5Edge detection sensitivity
iterationsINT11–5Number of blur passes

Outputs (1)

NameTypeDescription
resultIMAGE