ComfyUI Node

Refine Images

A gentle four-step cleanup chain for noisy or mushy images

By 2daadv·Created 6 months ago·Updated 21 days ago· 1
Refine Images
  • images
  • images
median_enabledtrue
median_radius1
denoise_enabledfalse
denoise_intensity0.10
aa_enabledtrue
aa_sigma0.5
sharpen_enabledfalse
sharpen_amount1.0

Refine Images is a small post-processing chain in one node: a median filter, an edge-preserving denoise, a Gaussian anti-alias, and an unsharp-style sharpen, each independently toggleable, applied in that order to a batch of images. It's aimed at dataset prep - this pack also ships training-tag editing, so the whole image section leans that way - but it's just as happy cleaning up a few noisy gens before you do anything else with them.

The name oversells it slightly. This is not an upscaler and it's not a restoration model. It's a deterministic, no-model pixel pass. What it buys you is control over the classic cleanup sequence without stitching together four separate WAS-style filter nodes.

How it works

Reading the source, each stage is a straightforward torch operation:

  1. Median filter (on by default, radius 1). Sliding window takes the median of each neighborhood instead of the mean. That's the go-to for salt-and-pepper noise and stray specks, because unlike a blur it leaves edges alone. Radius 1 is a 3×3 window.
  2. Denoise (off by default, intensity 0.1). This one's a homebrew bilateral-ish blend: it blurs the image, computes the difference, and uses an exponential of that difference as a mask to blend sharp and blurred. Flat regions smooth out, strong edges keep their edge. It's a lighter cousin of a proper bilateral filter, which the post-processing literature calls the right tool for "smooth without losing edges."
  3. Anti-alias (on by default, sigma 0.5). A plain Gaussian blur with a kernel sized from the sigma. Use it to soften jaggies and ringing after a resize.
  4. Sharpen (off by default, amount 1.0). Classic unsharp masking: blur a copy, subtract to isolate high-frequency detail, add that detail back scaled by amount. Crank it too high and you get the halo look, exactly as the amount knob would suggest.

The chain runs on the GPU via torch, and each stage feeds the next - so order is fixed: median → denoise → AA → sharpen.

Inputs and outputs

Inputs: images (a batch), plus one boolean + one value per stage - median_enabled/median_radius, denoise_enabled/denoise_intensity, aa_enabled/aa_sigma, sharpen_enabled/sharpen_amount. Output: images, same shape as the input batch.

That's the whole surface. The defaults are the part to internalize: median and AA on, denoise and sharpen off. That's the pack author's opinion of a safe baseline cleanup, and it's a reasonable one.

Install

ComfyUI Manager (search "ComfyUI-GadgetNodes"), or:

cd ComfyUI/custom_nodes
git clone https://github.com/2daadv/ComfyUI-GadgetNodes.git
pip install -r ComfyUI-GadgetNodes/requirements.txt

Restart, find it under Gadget/image. No models, no heavy deps.

Where people get burned

  • Stacking everything turns your image to mush. Each stage removes detail; the sharpen is there to give some back, but turning all four on full is a recipe for that plastic, over-smoothed look. The sharp-eyed default is on for a reason. If output looks waxy, start turning stages off, not on.
  • Median is slow at high radii. Radius 1 on a normal batch is fine; radius 8 is a 17×17 window per pixel and will make you wait. Keep it small.
  • It's a batch-in, batch-out node that expects a list - feed it a Load Images From Folder or a batched output and it processes each image independently. There's no temporal or cross-image logic.

Honest take: if you're already using a big image-utility pack you probably have these filters separately. The value here is the one-node ordering, the batch handling, and the defaults that actually match a sensible cleanup. For dataset cleanup before a LoRA run it's quietly very handy; for making a single gen look great, you're usually better off fixing the sampler than post-processing it.

CategoryGadget/image

Inputs (9)

NameTypeDefaultDescription
imagesIMAGE
median_enabledBOOLEANtrue
median_radiusINT11–8
denoise_enabledBOOLEANfalse
denoise_intensityFLOAT0.100.01–1
aa_enabledBOOLEANtrue
aa_sigmaFLOAT0.50.1–5
sharpen_enabledBOOLEANfalse
sharpen_amountFLOAT1.00.1–5

Outputs (1)

NameTypeDescription
imagesIMAGE