How To Smooth Edges In Gimp

By | 16/08/2022

Text and images Copyright (C) 2002 Eric R. Jeschke and may not exist used without permission of the writer.

Intention¶

before.jpg
after.jpg

In this tutorial I’ll show you how to practice smart sharpening of your images. Applying an unsharp mask to an entire image is not ever appropriate. A really expert instance of this is when you take an image with a lot of loftier
ISO
noise or film grain; applying across-the-board sharpening volition raise the dissonance/grain and make it even more visible, particularly in large prints. Oftentimes at that place will be large areas of the image that y’all know yous don’t want to acuminate (e.g. a blue heaven—the bluish aqueduct tends to go a lot of noise).

This technique does two “smart” things to avoid sharpening dissonance:

  1. acuminate only the luminosity channel, and
  2. create a channel mask that contains but the edges in the image. So you lot tin load the channel mask as a selection and employ the unsharp mask to just the edges.

Giving credit where credit is due: I did not come upward with this method. I adapted it for
GIMP
from a Photoshop tutorial on the luminous-landscape.com photography spider web site (great web site
BTW, I recommend it).

New information and comparison with the “warp sharp” script!

The Procedure¶

You may want to maximize your browser window to properly encounter this tutorial. I didn’t want to compress the image windows down like I usually do for the other tutorials since sharpening and dissonance are subtle and really show upwardly better at these larger sizes.

Stride 1¶

image-original.jpg

Here’s the original epitome loaded into
GIMP. It is noticeably soft, probably due to bad autofocus. It really shows upward in prints.

Note:
be sure to practice any other editing that you want to on the prototype first, especially downsampling or upsampling (resizing). Sharpening should ever be the last step that yous do.

Step ii¶

decompose.jpg
layers1.jpg

image-lab-decomposed.jpg

Duplicate the prototype by pressing
Ctrl+D
or right-click and select

Image -> Duplicate
. It might exist wise to minimize the original epitome window now. You can open it later to compare to the effect.

Correct-click on the duplicate epitome and select

Epitome -> Mode -> Decompose
. In the decompose dialog box, select
LAB
(or
HSV; see Notation 1). Check the “As layers” checkbox (see Notation ii) and click
OK.

This will create a new window with the epitome decomposed into the Luminosity (“brightness”), A and B channels every bit 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 racket.

At this indicate I usually plough off visibility of the A and B layers in the Layers dialog by clicking on the “optics”.

Notation ane:
if you lot happen to have an older version of the compose/decompose plug-in information technology may not have the
LAB
pick. In that case utilize
HSV
(hue/saturation/value) instead. For whatsoever reference to the “LAB” image or “luminosity” channel below, substitute the “HSV” epitome/”value” window. The
LAB
option was not in my initial version of
GIMP
(ver 1.2.i), 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 ii:
in the older version of the decompose plug-in there is no “Equally layers” checkbox; instead it will create the three channels as split windows rather than three layers in one window. Information technology really doesn’t matter if y’all do it this way; the layers way simply reduces the ataxia on your screen. If you don’t have the “As layers” pick, I suggest you minimize (but not close) the hue and saturation (or A and B) windows. We’ll need them afterwards, but you don’t desire to accidentally option one of them in the adjacent few steps.

Stride iii¶

edgedetection.jpg
image-edgedetect-grayscale.jpg

Get to the indistinguishable image. Correct-click and select

Filters -> Edge Detect -> Edge
. In the Edge Detect dialog box, select a parameter value of the appropriate size for the edges in your epitome. You may need to experiment with this. For the case image I chose half-dozen.

Now convert the edges paradigm to grayscale by right clicking on it and selecting

Image -> Mode -> Grayscale
. This image is going to become our sharpening mask.

Annotation:
in some tutorials they recommend converting to greyscale and then running the edge detection filter. The premise in that location (my guess) is that perhaps you don’t desire to detect noise as edges. My thinking is that there may be an edge in color, simply not tonality (e.yard. transition between two light colors). In one case you lot accept converted to greyscale you may not exist able to observe that border whatsoever more. Too, with a loftier enough edge detection parameter (here 6) you will avert detecting random
CCD
noise as edges.

Step 4¶

levels1.jpg
image-edgedetect-grayscale-levels1.jpg

The next step is to suit the tonality a little so that areas that demand sharpening are actually white and anything that doesn’t need sharpening at all is really black.

Open the Levels dialog (
Image -> Colors -> Levels
). Bring the black point up and the white betoken down to filter out whatever insignificant edges. You lot may need to play effectually with the exact positions of the sliders. Click
OK
when the image outlines the significant edges in white and most everything else is black.

How much you’ll demand to tweak this really depends on the prototype. There wasn’t a lot of spurious edges shown here, so a small adjustment was all that was necessary.

Step 5¶

iirgaussianblur.jpg
image-edgedetect-grayscale-levels-blur.jpg

Now apply a gaussian blur (
Filters -> Blur -> Gaussian Blur
) to smoothen out the edges a little. A radius of between 3 and 10 pixels (horizontal and vertical) should be enough. In the example I used 7.

Step six¶

levels2.jpg
image-edgedetect-grayscale-levels2.jpg

If you want to y’all can use Levels once more to adapt the white and black points of the mask. I find this is usually a adept thought after the blur.

In this instance I pulled the white bespeak slider downwards a chip.

Step 7¶

layers2.jpg
newchanneloptions.jpg

layers3.jpg

Open the Layers dialog. Select the
LAB
image (if
HSV, value) in the driblet down box at the top and then click on the Channels tab.

Click on the new channel push (newlayer) at the bottom of the dialog to create a new aqueduct. Name it “Sharpening Mask”.

Stride viii¶

layers4.jpg
layers5.jpg
image-lab-pastemask.jpg

Right-click in the blurred/edges image window and

Select -> All
. Right-click again and select

Edit -> Copy
. (Alternatively you tin use keyboard shortcuts
Ctrl+A
and
Ctrl+C
in succession).

In the Layers dialog, brand sure the Sharpening Mask channel is selected. Go back to the
LAB
(value) window and paste (
Edit -> Paste

or
Ctrl+V).

Select the Layers tab in the Layers dialog and click on the anchor push button (anchor) to anchor the floating prototype.

Step 9¶

layers6.jpg
image-lab-selection.jpg

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 lot properly pasted the sharpening mask into the new aqueduct. At this point y’all may wish to click on the heart icon to make the sharpening mask invisible.

Select the Sharpening Mask aqueduct and click the “Channel to Selection” button (channel-to-selection). You lot should come across “marching ants”.

You can experiment with feathering the selection here if you want; I usually don’t.

Stride 10¶

layers7.jpg
unsharpmask.jpg

image-lab-sharpened-zoomed.jpg

Of import:
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 just want to acuminate the luminosity channel.

Use an unsharp mask (
Filters -> Heighten -> Unsharp Mask
). You may want to experiment with the settings here. You volition find that yous can utilize much higher amounts of sharpening (than if the entire paradigm were selected) without significantly degrading the image.

In the example here I used Radius=1, Amount=ii.0 (200% ?), Threshold=0.

At present get rid of the selection (right-click and

Select -> None
) and zoom in (=
key) to examine the results. If you’re not happy with the results, undo and try the sharpen step again with different parameters.

Step 11¶

compose.jpg
image-lab-composed.jpg

It’southward time to reconstruct our original prototype from the
LAB
(HSV) components.

Right-click in the luminosity (value) window and select (
Image -> Manner -> Compose
). In the Compose Options dialog, brand certain that yous have selected
LAB
(HSV) on the left and on the right that the Luminosity, A and B (Hue, Saturation and Value) components are matched up with their respective images.

Click
OK; this should create a new composite image.

Final Step¶

image-original-zoomed100-crop.jpg
image-luminosityedgesharpened-zoomed100-crop.jpg

image-regularsharpened-zoomed100-crop.jpg

Examine the resulting paradigm, zooming in to examine edge detail.

It may help to unminimize the original image for comparing. If you feel your prototype 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 yous tin close all the extraneous windows.

The images on the right are zoomed to 100% and cropped:

  • Left paradigm: original image
  • Eye image: smart-sharpened image
  • Right prototype: sharpened with a typical unsharp mask filter (Radius=i, Amount=ane.0 (100% ?), Threshold=0)

The smart sharpened image hardly shows whatsoever boosted noise over the original prototype. Notice how the “regular” unsharp masked version at half the sharpening amount has much more than visible racket, especially in the shadows on the side of the face up and in the door frame of the auto.

Check out the shadow dissonance in the larger images on the smart sharpening shortcuts and variations page.

Tips¶

  • If this seems like too long and complicated of a process, you might be interested in looking at some shortcuts and variations that are notwithstanding ameliorate than a simple sharpening pace.
  • Some very well-respected experts on image manipulation (eastward.g. Real World Photoshop, Blatner and Fraser—great book) suggest that style changes in and out of
    RGB
    are non to be taken lightly. You can lose a suprising amount of information. For example, try the following experiment:

  • Open a new blank prototype.

  • Using the gradient tool, create a slope from black to white across it.
  • Convert it to
    RGB
    (
    Image -> Mode ->
    RGB
    ).
  • Look at it’s histogram (
    Epitome -> Colors -> Histogram
    ).
  • Convert it to
    LAB, past decomposing to
    LAB
    (
    Image -> Mode -> Decompose
    ), and then exercise a compose on the
    LAB
    image back to
    RGB
    (
    Epitome -> Fashion -> Compose
    ).
  • Expect at the new epitome’south histogram.

Hither is what you’ll see if you compare them:

gradient.jpg
gradient-composed.jpg

Left image: Gradient in
RGB
Right image:
RGB
->
LAB
->
RGB

gradient-hist.jpg
gradient-composed-hist.jpg

Left image: Histogram of the
RGB
prototype. Right epitome: Histogram of the
RGB
->
LAB
->
RGB prototype.

gradient-zoomed400.jpg
gradient-composed-zoomed400.jpg

Left image: Zoom 400% of the
RGB
image. Correct paradigm: Zoom 400% of the
RGB
->
LAB
->
RGB image.

Expect at all the information that has been lost in the converted image! There is obvious posterization in the zoomed close upwards.

You are now thinking to yourself, “Good grief! Why on earth would he suggest irresolute modes to sharpen the luminosity aqueduct if it has this kind of effect?”

Expect at the histograms of the original image and the i smart sharpened on the luminosity channel:

original-hist.jpg
smartsharpened-hist.jpg

Left paradigm: Histogram, original image Right paradigm: Smart-sharpened on luminosity channel

You can see that in practice, changing modes does not ever take this drastic of an effect.

What should you do? I suggest trying information technology and expect 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, equally suggested in the shortcuts. All the same, this does indicate out a general piece of communication, which is to utilize the histogram regularly. Information technology is a keen tool to monitor what is happening to your image “numerically” equally y’all edit it.

Other Examples¶

example1-original-crop.jpg
example1-regularsharpened-crop.jpg
example1-luminosityedgesharpened-crop.jpg

Starting time image: Original (pretty noisy) Left image: Standard unsharp mask Right image: Smart sharpened

This instance is kind of contrived. It doesn’t really need much sharpening in the first identify, and the smart-sharpened version looks over-sharpened. I include information technology hither 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 dissonance. For details on reducing
CCD
noise (using this image as an example), run into this tutorial.

example2-edgesharpened-384x384.jpg
example2-regsharpened-384x384.jpg

Left prototype: Edge sharpened (Amt=1.25) Right image: Standard unsharp mask (Amt=0.50)

Further Reading¶

  • Almost Everything Y’all Wanted to Know Near Sharpening in Photoshop
  • Follow-upwards article to the above, A Two-Pass Approach to Sharpening in Photoshop
  • Fred Miranda: The Ultimate Sharpening Technique

The original tutorial used to appear on gimpguru.

Source: https://www.gimp.org/tutorials/Smart_Sharpening/