Text and images Copyright (C) 2002 Eric R. Jeschke and may not be used without permission of the author.
In this tutorial I’ll show you how to do smart sharpening of your images. Applying an unsharp mask to an entire image is not always appropriate. A really good example of this is when you have an image with a lot of high ISO noise or film grain; applying across-the-board sharpening will enhance the noise/grain and make it even more visible, especially in large prints. Often there will be large areas of the image that you know you don’t want to sharpen (e.g. a blue sky—the blue channel tends to get a lot of noise).
This technique does two “smart” things to avoid sharpening noise:
Giving credit where credit is due: I did not come up with this method. I adapted it for GIMP from a Photoshop tutorial on the luminous-landscape.com photography web site (great web site BTW, I recommend it).
New information and comparison with the “warp sharp” script!
You may want to maximize your browser window to properly see this tutorial. I didn’t want to shrink the image windows down like I usually do for the other tutorials since sharpening and noise are subtle and really show up better at these larger sizes.
Here’s the original image loaded into GIMP. It is noticeably soft, probably due to bad autofocus. It really shows up in prints.
Note: be sure to do any other editing that you want to on the image first, especially downsampling or upsampling (resizing). Sharpening should always be the last step that you do.
Duplicate the image by pressing Ctrl+D or right-click and select
Right-click on the duplicate image and select
This will create a new window with the image decomposed into the Luminosity (“brightness”), A and B channels as 3 layers. This will allow us to isolate and sharpen the luninosity channel which is a) the most important, and b) should be the cleanest in terms of noise.
At this point I usually turn off visibility of the A and B layers in the Layers dialog by clicking on the “eyes”.
Note 1: if you happen to have an older version of the compose/decompose plug-in it may not have the LAB option. In that case use HSV (hue/saturation/value) instead. For any reference to the “LAB” image or “luminosity” channel below, substitute the “HSV” image/”value” window. The LAB option was not in my initial version of GIMP (ver 1.2.1), but I got the newer version of the plug-in at the GIMP Plug-in Registry and compiled it myself. Don’t worry if you don’t have it; HSV works great too.
Note 2: in the older version of the decompose plug-in there is no “As layers” checkbox; instead it will create the three channels as separate windows rather than three layers in one window. It really doesn’t matter if you do it this way; the layers way just reduces the clutter on your screen. If you don’t have the “As layers” option, I suggest you minimize (but not close) the hue and saturation (or A and B) windows. We’ll need them later, but you don’t want to accidentally pick one of them in the next few steps.
Go to the duplicate image. Right-click and select
Now convert the edges image to grayscale by right clicking on it and selecting
Note: in some tutorials they recommend converting to greyscale and then running the edge detection filter. The premise there (my guess) is that perhaps you don’t want to find noise as edges. My thinking is that there may be an edge in color, but not tonality (e.g. transition between two light colors). Once you have converted to greyscale you may not be able to detect that edge any more. Besides, with a high enough edge detection parameter (here 6) you will avoid detecting random CCD noise as edges.
The next step is to adjust the tonality a little so that areas that need sharpening are really white and anything that doesn’t need sharpening at all is really black.
Open the Levels dialog (
How much you’ll need to tweak this really depends on the image. There wasn’t a lot of spurious edges shown here, so a small adjustment was all that was necessary.
Now apply a gaussian blur (
If you want to you can use Levels again to adjust the white and black points of the mask. I find this is usually a good idea after the blur.
In this example I pulled the white point slider down a bit.
Open the Layers dialog. Select the LAB image (if HSV, value) in the drop down box at the top and then click on the Channels tab.
Click on the new channel button () at the bottom of the dialog to create a new channel. Name it “Sharpening Mask”.
Right-click in the blurred/edges image window and
In the Layers dialog, make sure the Sharpening Mask channel is selected. Go back to the LAB (value) window and paste (
Select the Layers tab in the Layers dialog and click on the anchor button () to anchor the floating image.
Click on the Channels tab in the Layers dialog. You should see a tiny version of the sharpening mask in the channel icon, indicating that you properly pasted the sharpening mask into the new channel. At this point you may wish to click on the eye icon to make the sharpening mask invisible.
Select the Sharpening Mask channel and click the “Channel to Selection” button (). You should see “marching ants”.
You can experiment with feathering the selection here if you want; I usually don’t.
Important: in the Layers dialog, click on the Layers tab and make sure the luminosity layer (if HSV, Background layer of Value window) is selected, and is the only one selected. We only want to sharpen the luminosity channel.
Apply an unsharp mask (
In the example here I used Radius=1, Amount=2.0 (200% ?), Threshold=0.
Now get rid of the selection (right-click and
It’s time to reconstruct our original image from the LAB (HSV) components.
Right-click in the luminosity (value) window and select (
Click OK; this should create a new composite image.
Examine the resulting image, zooming in to examine edge detail.
It may help to unminimize the original image for comparison. If you feel your image needs more/less sharpening, then go back to the LAB window, undo twice and redo the unsharp mask step above.
When you are satisfied with the result you can close all the extraneous windows.
The images on the right are zoomed to 100% and cropped:
The smart sharpened image hardly shows any additional noise over the original image. Notice how the “regular” unsharp masked version at half the sharpening amount has much more visible noise, especially in the shadows on the side of the face and in the door frame of the car.
Check out the shadow noise in the larger images on the smart sharpening shortcuts and variations page.
Some very well-respected experts on image manipulation (e.g. Real World Photoshop, Blatner and Fraser—great book) suggest that mode changes in and out of RGB are not to be taken lightly. You can lose a suprising amount of information. For example, try the following experiment:
Open a new blank image.
Here is what you’ll see if you compare them:
Left image: Gradient in RGB Right image: RGB -> LAB -> RGB
Left image: Histogram of the RGB image. Right image: Histogram of the RGB -> LAB -> RGB image.
Left image: Zoom 400% of the RGB image. Right image: Zoom 400% of the RGB -> LAB -> RGB image.
Look at all the information that has been lost in the converted image! There is obvious posterization in the zoomed close up.
You are now thinking to yourself, “Good grief! Why on earth would he suggest changing modes to sharpen the luminosity channel if it has this kind of effect?”
Look at the histograms of the original image and the one smart sharpened on the luminosity channel:
Left image: Histogram, original image Right image: Smart-sharpened on luminosity channel
You can see that in practice, changing modes does not always have this drastic of an effect.
What should you do? I suggest trying it and look at the histogram! This is the beauty of the digital darkroom. If your image is not that noisy anyway, then no need to change modes, as suggested in the shortcuts. However, this does point out a general piece of advice, which is to use the histogram regularly. It is a great tool to monitor what is happening to your image “numerically” as you edit it.
First image: Original (pretty noisy) Left image: Standard unsharp mask Right image: Smart sharpened
This example is kind of contrived. It doesn’t really need much sharpening in the first place, and the smart-sharpened version looks over-sharpened. I include it here mainly because it is pretty noisy, so it really shows what happens when you sharpen noise, and how the smart sharpening technique doesn’t affect the noise. For details on reducing CCD noise (using this image as an example), see this tutorial.
Left image: Edge sharpened (Amt=1.25) Right image: Standard unsharp mask (Amt=0.50)
The original tutorial used to appear on gimpguru.