Median Filter Image
The noise-removal blur that doesn't smear edges into mush
- images
- IMAGE
A gaussian blur averages a pixel's neighborhood - which means one wild outlier pixel (salt-and-pepper noise, a stray artifact) drags the average with it. A median filter takes the median of the neighborhood instead, which just ignores outliers entirely - they're not the median, so they don't get counted. The README's own framing: it removes high-frequency information "useful for frequency separation workflows," which is exactly where this node earns its place.
Frequency separation - splitting an image into a low-frequency (tone/color) layer and a high-frequency (fine detail) layer, fixing one, and recombining - is a real, actively-used technique in this ecosystem, most notably as the standard community fix for IC-Light's skin-tone shift problem: take lighting from the relit version, take detail from the original. This node is a building block for constructing that low-frequency layer yourself, with the noise-robustness a median filter brings that a plain gaussian blur doesn't.
The one setting that matters
images(IMAGE) - required.size(default 1, 1–1023) - the filter's neighborhood size. At the default of1this is essentially a no-op - you have to raise it to get any effect.
One output: IMAGE.
When to reach for this over a plain blur
If your goal is general softening - a background blur, a low-pass layer where noise isn't a specific concern - this pack's Blur Image (Fast) is the faster, more typical choice. Reach for Median Filter Image specifically when you're removing speckle, salt-and-pepper noise, or building a genuinely noise-robust low-frequency layer for frequency separation, where a gaussian blur would blend outlier noise into the surrounding pixels instead of discarding it.
How to install it
ComfyUI Manager: search "ComfyUI-Image-Filters", install, restart. Manual:
cd ComfyUI/custom_nodes
git clone https://github.com/spacepxl/ComfyUI-Image-Filters
restart. Dependency is opencv-contrib-python; a cv2 import error on startup usually means another node pack installed a conflicting opencv variant, not this pack being broken - the author's install.bat/import_error_install.bat fix that on Windows, and manually elsewhere it's uninstalling stray opencv packages and reinstalling opencv-contrib-python alone. No models, no meaningful VRAM cost.
Common issues & troubleshooting
No visible effect. size defaults to 1, which does essentially nothing - you have to raise it deliberately. Start small (3-5) and increase until the noise you're targeting clears out.
It's noticeably slower than a gaussian blur at a similarly large radius. That's expected - a median filter is more expensive per pixel than averaging-based blurs, especially at large size. If you don't actually need the noise-robustness (you're just softening, not fighting speckle), Blur Image (Fast) will be faster for a similar visual softening effect.
Used it expecting a smooth, soft-focus look and got something patchier instead. Median filtering doesn't produce the same smooth gradient a gaussian blur does - it can leave a slightly blocky or posterized quality at large sizes, since it's picking an actual existing pixel value rather than blending. If you want a smooth look specifically, that's a job for gaussian (Blur Image (Fast)) instead.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| images | IMAGE | — | |
| size | INT | 11–1023 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |