How to edit out digital noise

Night exposures are especially prone to noise, but it can also show up in gradient areas like a daytime sky, or smooth water.

Here's a quick technique to help clean up digital images from an inherent issue with the digital sensor.

First off, let me note that there are two kinds of "noise" in digital images. The first kind is odd speckling and uneven blotches from very low exposures, often made much worse by using higher ISO settings. There is no single way to eliminate this, because it's widely variable.

But the second kind is caused by small imperfections in the digital sensor itself, and can be determined mostly by being very bright and distinct, often just single pixels, and by the fact that they're always in the same place. This is the kind that is not only most noticeable, it's easy to get rid of. Some cameras already do this on their own, but you can do this in a decent photo editing program, in just a minute once you've gotten the hang of it.

As with any digital editing, make sure you do not alter your original image, so you can always start over. If this means opening a copy, or opening an original but immediately saving it under a different filename, whatever. Just always be sure not to overwrite your original.

Also, clean your monitor before attempting any kind of exacting digital cleanup. Dust on your viewing surface resists any and all editing tricks ;-)

Believe it or not, I still use Photoshop 6, so you may have to translate a little for the program you're using yourself, but nearly every program should do this, one way or another.

Step one: Get a noise baseline. This is easy. Leaving the lenscap on, and for preference doing this in a dark room or with the camera buried under a dark cover, get a 30 second exposure of absolutely nothing. You'll need to switch to manual settings for this. It doesn't really matter what aperture setting you use, but if you like, go with the largest (smallest f-stop) to save a little wear on the aperture. By all rights, the resulting image should be completely black, but chances are, you have some color spots in it. Those are sensor issues; they'll appear in every image of a certain darkness, and those are what we're going to remove. Save this image, at full resolution and in uncompressed format (raw or tif is fine, but even jpeg at no compression works) under a name like "noise filter."

Step two: Open this image in our editing program, select the entire image, and copy it.

Step three: Open the image to be cleaned in the same program.

Step four: Paste the copied filter image over top of the image to be cleaned. Everything should have gone black — this is what you want, so don't worry about it. It is simply on a new layer over top of your good image, but that one still exists underneath.

Step five: Select the black areas of the noise layer. To do this, you can usually use "Select/Color Range", but the Magic Wand or color selection tool works largely the same. The key is to get all of the black areas, but leave behind any of the colored areas, even if very dark grey, so you will probably want to adjust the tolerance to do this. In Photoshop, the setting I use is a "Fuzziness" of 20.

Once selected, zoom way in on the image until you're seeing individual pixels, and skid around a bit to see how much has been selected. If it's not enough, lower the tolerance, but if it's too much, increase the tolerance. It's always easy to deselect what you had and try again. As can be seen in my example, I even have a pixel that looks black, and there's nothing wrong with this, as long as you don't have too many of them (its actual RGB value is 12,14,11, as opposed to true black which is 0,0,0).

Step six: Delete the black. Usually just hitting the delete key works, but you can use a menu command to delete the selection, whatever works. At this point, your image should have reappeared, since most of the overlaying noise filter image has been eliminated, and all that's left is the noise itself. Be patient, that's next.

Step seven: Select the noise instead. In Photoshop, this is "Select/Inverse". You might have seen a very subtle change in the selection border, or you may not. We'll know if this worked in two steps.

Step eight: Merge the layers. You can use "Layer/Flatten image", or if you're used to working with layers, you can merge the two by indicating the main image layer with the little 'links' in the Layer window. Whatever works. If you are asked to deselect or eliminate your selection of the noise, you do not want to do this.

Step nine: Eliminate the noise. Go to the "Filter" menu, select "Blur", then "Gaussian Blur". I usually use a radius of 5 pixels to effectively eradicate even the brightest spots, but you'll want to zoom in on a section and try it out. In Photoshop, there is a preview screen in this step, so you can click on the main image where there was noise (it should still show a selection border) and increase the preview to several hundred percent to see the projected result in detail. The desired result is to vanish entirely, or nearly so (you'll notice that the illustration shows only 1.8 pixels, and it isn't enough.)

What you're actually doing here is mixing the selected noise pixels with the surrounding parts of the image, so they'll take on the hue of the neighboring pixels. We can't simply eliminate them, because that would produce a hole in the image showing the background color (which doesn't exist) and we can't "paint" them black or whatever, since this would often look almost as bad as the noise. So we blend them with Gaussian Blur, and they become camouflaged into their surroundings. Since we first selected just the black of the empty image, then inverted to select what wasn't black, the selection was only on the noise pixels, and that's all that we changed.

Step ten: Deselect and you're done. Like I said, this will not get rid of the noise produced by higher ISO settings, but it does eliminate those bad pixels on the sensor. It actually works best to create a new noise filter image from time to time, since as the camera ages these will generally increase..

In the above full resolution before-&-after example of a long night exposure to capture the Milky Way, you can see that the bad sensor pixel noise is eliminated, but not the blotchiness in the sky (this is only a fragment of the image — I actually got a fairly decent image of the Milky Way.) This blotchiness, the first type of noise that I mentioned, is caused by varying sensitivity to very small amounts of light, and even stray electrical signals and ambient air temperature affecting how the digital sensor changes the light into an electronic code. As such, it's hard to avoid. You can do much the same trick as we just did, by selecting the sky color of the original image instead of the black of the noise filter, but in circumstances like this where I was trying to capture the stars, sufficient Gaussian Blur to clean up the sky will also wipe out the visible stars, so it's usually better to cope with it.

Also, keep in mind your intended end usage. If displayed on a webpage like this or sent in e-mail to someone, you'll have reduced the size of the image considerably, and with it the noise — you might not notice it at all, without having to filter it out. But if you're going for detail or prints, that's when you want the noise to vanish

When we're talking astrophotography like this, I had boosted the ISO to get as much detail as I could in a shorter exposure, so I could avoid the star streaks that would be caused by the earth's rotation. The other method is to go for low ISO and long exposures, but have the camera moving on a tracking rig to compensate for the earth's movement. That's a bit more elaborate to arrange ;-)

What's this?