Unsharp Mask
Sharpening that adds punch, not crunchy halos
- images
- IMAGE
Every diffusion render comes out a little soft - the model just doesn't nail pixel-sharp edges. Unsharp mask is the classic fix: it doesn't invent detail, it just makes the detail that's already there bite harder. You've probably used this filter's distant cousin in Photoshop without knowing the name. Same idea, here as a node.
How it works
The math is gloriously simple. Kornia's unsharp_mask takes your image, blurs a copy of it with a gaussian kernel, and then computes:
out = 2 * image − blurred
Subtracting the blur from the image cancels the low-frequency, flat parts and leaves the high-frequency edges boosted. It's the same trick as a high-pass filter, just done in one step. The node passes it two knobs: kernel_size (1–20, default 3) sets the blur kernel, and sigma (0–10, default 1.25) sets how wide that blur is. There's no separate "amount/strength" slider - the 2× blend is fixed - so you tune strength through kernel size and sigma instead. Wider sigma means a blurrier reference copy, which means a stronger, broader sharpening effect.
One honest caveat: like every node in this pack, it runs on CPU (the tensor gets moved off the GPU), and it's a global effect - no mask input, no "sharpen only the face" option. If you want selective sharpening, use it on a region you've already cropped.
The inputs that matter
- images - a ComfyUI IMAGE. Feed it the VAE-decoded output, or post-upscale to put the edge back that resizing softened.
- kernel_size (default 3) - keep it odd. 3 is the safe everyday value.
- sigma (default 1.25) - the real sharpening dial. Start at 1 and creep up; you'll see the image get snappier before it gets ugly.
The output is an IMAGE, same resolution, ready for Save Image or another processing step.
Installing it
It ships in the ImageProcessing pack by bvhari - seven small wrapper nodes around the Kornia computer-vision library, nothing else. Install once and you get all of them:
cd ComfyUI/custom_nodes
git clone https://github.com/bvhari/ComfyUI_ImageProcessing
# restart ComfyUI; kornia installs automatically from requirements.txt
ComfyUI Manager users: search "ImageProcessing" in the Custom Nodes Manager, Install, restart. No models to download, no keys, no GPU requirement - which is honestly the whole appeal of this pack.
When it bites
The classic failure is halos - that white or dark rim that appears along strong contrast edges when you overdo it. That's the blur getting subtracted hard on one side of an edge. Fix: lower sigma and kernel_size rather than accepting the crunch. If nothing changes at all, remember the default 3×3 kernel is barely a nudge; that's normal, not a bug. And if kornia shows up missing in the console, pip install kornia into your ComfyUI environment sorts it.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| images | IMAGE | — | |
| kernel_size | INT | 31–20 | — |
| sigma | FLOAT | 1.250–10 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |