Noise reduction and unsharp mask · before and after

Image Denoise and Sharpen

Smooth grain out of flat areas without smearing edges, then add crispness back with an unsharp mask. Test on a 720 × 480 crop at full magnification first, because noise and sharpening only show clearly at 100%.

Picture

Drop a photo here, paste, or click to choose

PNG, JPG, WEBP, GIF or BMP, up to 25 MB. Larger pictures are scaled to 2800 px on the long side.

Noise reduction

Higher values average colours that differ more, which removes more grain and more fine texture.

Unsharp mask

Width of the halo. Around 1 px suits a 2 to 6 megapixel picture.

Edges softer than this are left alone, so grain is not sharpened.

Run and save

Before and after

Your picture appears here.

Image Denoise and Sharpen

Operator: Abdulla Al Fahad. How tools are built and checked

Noise and sharpening both hide at screen-fitting zoom. A picture can look clean fitted to a window and gritty at 100 percent, and an unsharp mask that looks right at 100 percent can halo at print size. So this page tests on a 720 x 480 crop of your picture at 100 percent first, shows it before and after with a slider, and only then runs the whole frame.

On a synthetic 256 x 192 test image of flat areas and a soft edge, with Gaussian noise of 12 levels per channel (26.5 dB), a bilateral filter at strength 40 reaches 39.6 dB, the 5 x 5 non-local-means search 39.1 dB and the 7 x 7 search 41.4 dB.

Key features

  • Two denoisers: a bilateral filter with a 1 to 6 pixel window, and non-local means over a 5 x 5 or 7 x 7 search window
  • An unsharp mask with radius 0.3 to 5 px, amount up to 500 percent, a threshold in levels and a brightness-only option
  • A before and after slider on a 100 percent crop or the whole picture, with an estimated noise figure for each

Two denoisers, the unsharp mask and the noise estimate

Accepted photos are PNG, JPG, WEBP, GIF (first frame) or BMP files of up to 25 MB, scaled to at most 2800 px on the long side (about 7.8 megapixels) so the worker's run time and memory stay predictable. Output is PNG, or JPG at quality 95. The button that processes the whole picture always works on the whole scaled frame, even when the preview is a crop.

The noise figure is Immerkaer's fast estimate: the brightness channel is convolved with a difference-of-Laplacians mask, and the mean absolute response is scaled to a standard deviation in 0 to 255 levels. It reads grain in flat areas well and overstates a little on busy texture, so use it to compare before and after, not as an absolute measurement. On the test image above it reads 8.2 for noise of 12 per channel, which is 8.0 in brightness.

How it works

Bilateral: every pixel becomes a weighted average of the pixels in its window. A neighbour's weight is the product of a spatial term, a Gaussian over distance with sigma half the radius, and a range term, a Gaussian over colour difference with sigma 4 + 0.6 x strength. A pixel across an edge differs a lot in colour and gets almost no weight, so edges stay put while flat areas smooth out.

Non-local means, lite: pixels are averaged with others in the search window, weighted by how similar their 3 x 3 neighbourhoods are, not by how close they are. Each offset in the window is one whole-image pass: a squared-difference image, a 3 x 3 box mean, and a weight of exp(-(difference - 2 sigma squared) / h squared) with h = 3 + 0.35 x strength. Passes run on bands of 192 rows, so a large picture never needs several full-size buffers.

Unsharp mask: the picture is blurred with a Gaussian (three box passes), and the difference between picture and blur is added back times the amount, but only where it is at least the threshold. In brightness-only mode the difference in luminance is added equally to red, green and blue, which sharpens edges without shifting their hue. The Photo Adjust and Filter Editor on this site sharpens with a fixed 3 x 3 kernel and one strength slider; this page adds radius, amount and threshold.

Common use cases

  • A high-ISO event photo opened at 2800 x 1867: apply non-local means with the 5 x 5 window at strength 40 to the centre crop first, and if faces look plastic, lower it to 25 before running the 5.2 megapixel frame.
  • A flatbed scan of a printed photo: bilateral at radius 3 and strength 30 keeps the edges of a face while smoothing the paper grain, then a 0.8 px unsharp mask at 80 percent restores the crispness lost to scanner softness.
  • A product photo that is already clean: turn denoising off and use only the unsharp mask at radius 0.6 px, amount 60 percent and threshold 3 to win back the softness left by downsizing.

How to use this tool

  1. Open a photo; one over 1.2 megapixels starts in 100 percent crop mode.
  2. Pick a denoiser and a strength, then turn the unsharp mask on and set its radius, amount and threshold.
  3. Press Apply to preview and drag the slider to compare, and read the two noise figures.
  4. When the crop looks right, press Process the whole picture and download.

Example

A step edge from 80 to 160 across 64 px, unsharp radius 1.5 px, amount 150 percent, brightness only

threshold 0
threshold 200

Pixel values either side of the edge (it lies between x = 31 and x = 32)

x=28 80, x=30 62, x=31 36, x=32 204, x=33 178, x=35 160
x=28 80, x=31 80, x=32 160, x=35 160 (nothing changed)

Common pitfalls

Denoising removes detail along with grain. At strength 100 the range sigma is 64 levels, and fine textures such as hair, fabric and foliage are the first to go, so compare the crop before and after rather than the whole frame.

Non-local means with a 7 x 7 search does 48 whole-image passes against 24 for 5 x 5, so it takes roughly twice as long; Cancel stops the worker at any time.

  • Set the threshold near the noise figure shown under the preview. With an estimated noise of 8 levels, a threshold of 6 to 8 sharpens edges while leaving flat grain alone, which is what the control is for.
  • Let the radius follow the output size: about 1 px for a 2 to 6 megapixel picture viewed on screen, and 0.5 px or less for one you will shrink afterwards, because shrinking narrows a halo.

Common errors and how to fix them

The processing worker stopped unexpectedly
A very large picture can run out of memory in a worker on a small device. Choose the 5 x 5 search window, or shrink the picture before opening it; the page already scales to 2800 px on the long side.

Which denoiser to choose

Bilateral is the quicker and more predictable filter: a local average that refuses to cross strong edges, so it suits scans, screenshots and flat illustrations and leaves texture alone at low strength. Non-local means can borrow from any similar-looking patch in the search window, so it keeps repeating texture such as brick or fabric better, but at high strength it can flatten small features that look like noise.

On the 256 x 192 test image the two end within half a decibel of each other at the 5 x 5 setting (39.6 against 39.1 dB), and the 7 x 7 search is 1.8 dB better than bilateral. A synthetic image of flat areas favours averaging, so check real photos on the crop.

Reading the two noise figures

After processing, the page repeats the estimate twice: once on the denoised picture, before any sharpening, and once on the final result. On the test image non-local means alone leaves an estimate of 0.9, and adding the default unsharp mask (radius 1, amount 100, threshold 2) brings it to 1.3. The rise is not new noise: sharpening boosts every fine detail, grain included, and the estimate measures fine detail. If the figure after sharpening is far above the one after denoising on a flat picture, the settings are sharpening grain; raise the threshold or lower the amount.

Frequently asked questions

Why does the noise figure go up when I sharpen?

The figure is an estimate of fine detail in flat areas, and an unsharp mask boosts fine detail, whether it is grain or texture. Read the figure after denoising for how clean the picture is, and judge the sharpening by eye on the crop.

Why is the picture limited to 2800 px?

Non-local means makes one whole-image pass for each position in its search window, so the work grows with the pixel count times 24 or 48. Capping the long side at 2800 px keeps a run to a few seconds of work and a bounded amount of memory.