Removing Spots, Dust and Scratches from Photographs in GIMP

Adapted with permission from
GIMP 2.8 for Photographers: Image Editing with Open Source Software (Rocky Nook)
By Klaus Goelker
Copyright 2013

Older photos and slides often have flaws, such as creases, dog-ears, spots, dust, scratches, and missing edges. When you scan slides, lint and dust often end up on the image. Even digital images can have distracting elements that need retouching, such as overhead wiring in the scene or, dust on the camera sensor. The touchup work involved in fixing such images is called constructive touchup since it involves reconstructing image elements. Constructive touchups also include removing image elements such as unwanted text.

In the past, photographers armed themselves with brushes, masks, and airbrushes when fixing damaged images. Nowadays, images are scanned “as is” and the photographer’s repair tools are supplied by the image editing program. But the techniques are similar, the main difference being that the tools are now in digital form. It seems as if every new version of a digital editing program introduces new tools for the correction and stylization of images.

In addition to repairing flaws with the Clone tool, you can remove unwanted elements from an image. Don’t forget to save your image when you’re finished.

Why You Need Smooth Brushes—the Clone Tool

The Clone tool uses image data and patterns to “draw” not only colors, but also color details and textures. These structures are actually pieces of your image that you previously copied from a defined area in the same image. This tool is capable of doing more than just working with “normal” opacity. Since you can set the tool’s opacity from opaque to transparent, you can use this glazing technique to create smooth transitions, using a soft, feathered pointer. The Clone tool is considered the touchup tool.

The Clone tool uses the same brush pointers available to the drawing tools. Choosing Windows > Dockable Dialogs > Brushes, you will find brush pointers with hard, sharp edges that draw like pens with fixed widths as well as pointers with soft edges or feathering that draw more like a paint brush, with rich color in the center that fades as it moves toward the edges. Moreover, there are brush pointers in the form of patterns that apply color in structures.

For this exercise, you will use the Clone with “soft” pointers. Brushes with hard edges will create image patterns with sharp edges. That may be acceptable for a single color, but if you are working with structures, even similar structures, the image will look like it’s been strewn with confetti. A softer brush pointer creates a smooth transition.

Because GIMP doesn’t come with a large array of brushes, it provides a simple way to create new brushes. You can create a selection of additional brush pointers in advance so that you can change a pointer quickly when you’re working. Once you have created a brush, you can save and reuse it.

The new GIMP version adds a number of features that make working with brushes simpler and more versatile. The range of available brush presets has been extended and the brush system has been significantly improved.

In previous versions of the program, brush size could be selected using a percent value. Now, you can enter a size value in pixels in a range from 1 to 2000. That said, brush sizes above 500 pixels are seldom genuinely useful. Very large brushes often test the limits of a computer’s processing power.

You can now change the aspect ratio of a brush while you work using a slider in the tool settings—for example, from a circle to an ellipse.

Rotating brush support has been added, allowing you, for example, to adjust the pitch of an elliptical or star-shaped brush while you work.

The brush dynamics system has been separated from the other tool options and expanded, making it possible to drive almost all aspects of a brush with a multitude of inputs. You can now save the existing state of any tool as a preset and give it a meaningful name.

These and various other improvements are designed to simplify using GIMP for painting and producing illustrations.

Creating New Brush Pointers in GIMP and Importing Adobe Photoshop Brushes

To create new brush pointers for future use, just select the Brushes dialog from the dock or access it from the Windows > Dockable Dialogs > Brushes menu option.

In the Brushes window, click the New Brush button. The Brush Editor window appears.

The Brushes selection window with the prepared standard brushes. By clicking the little button at the top right, you can access a menu that will let you select the size and alignment of the icons and layout for this window.

Begin by selecting a shape for the new brush: circle, square, or diamond.

Clicking the New button in the Brushes window opens the Brush Editor window.

Use the Radius option to define the radius between the center and the edge of the new brush. However, the resulting brush size will always be slightly bigger than twice the indicated radius.

Spikes has an effect only on squares and rhombuses. The selected value indicates the number of corners the shape has. A square can be changed into a polygon, a rhombus into a star.

Hardness defines the amount of feathering that will occur. A value between 0.00 and 0.50 is recommended for soft, wide feathering.

If you want to create a calligraphic effect, you can use the Angle option to build a nicely angled brush. An aspect ratio greater than 1.0 is required.

Leave the value for Angle at 0.0 and for Aspect ratio at 1.0. A round, even brush is most suitable for working with the Clone tool. Give your new brush a name with the size and properties in the text field for future reference—for example, Circle Fuzzy (65).

Spacing is the setting for the distance between two points, set by the brush while drawing. A brush stroke in an image manipulating program is not continuous, but a line of dots at a certain distance. Depending on the size of the brush pointer, you have to reduce the default setting of 20 to 10 or less to get a smooth, continuous line; otherwise, the line will look dotted. (You could use this as a special effect.) This setting can be altered while drawing, after defining the brush.

When you close the Brush Editor, the new brush is saved permanently in the program. Your new brush can now be found in the Brushes window; just click on it whenever you wish to use it.

To speed up your workflow, create a total of seven new brush pointers with soft edges and diameters of 25, 35, 45, 65, 85, 100, and 200 (i.e., set Radius to 11.5, 16.5, 21.5, 31.5, 41,5, 50, 100; remember: the resulting brush size will always be slightly bigger than twice the indicated radius). This will give you a good array of brush choices. For finer detail work, it is a good idea to use smaller soft brushes sized from 1 x 1 to 19 x 19.

You can use the Brush Editor at any time to edit your custom brush pointers or to create new ones. The maximum brush radius is 1000 px. When setting the size for a brush in the Brush Editor, first use the sliders to get an approximate size. Next, fine-tune your new brush by using the cursor keys (arrows) or by typing the exact value desired in the text fields.

If you want to create more brushes with the same characteristics but different diameters, the program offers you the option of copying an existing brush. Choose the brush with the desired characteristics in the Brushes window and then click the Duplicate brush button. This is the third button from the left in the Brushes window.

The Brush Editor opens. Now you can customize your brush according to your preference and give it a new name. The brushes provided by GIMP can only be customized if they are duplicated and then changed to your preference. The default brushes are write-protected and can’t be altered.

As previously mentioned, GIMP offers an intuitive way to change the scale of the brush while it is in use. You can do this with all tools that work with a brush pointer, including the Clone tool. You can change the size of the brush by adjusting the Size option in the tool settings. You can adjust the size of the brush tip to the nearest pixel either by using the Size slider or by entering your desired values in the option box.

Another useful new feature is the ability to tag brush presets, which makes it possible to search for presets by name in the Brushes dialog. Simply select a brush and enter the appropriate tag in the field located beneath the brush preview window. Clicking a brush type in the filter list or entering a tag manually displays only appropriately tagged brushes in the preview window. To return to the default Brushes dialog view, select and delete any tags that you have entered in the Tags field.

The Brushes window: There is a text input box beneath the preview window that you can use to tag brushes. You can then search and select tagged brushes either via the filter list or by entering tags in the input box.

Importing Brush Pointers from Adobe Photoshop into GIMP

It is comparatively easy to import brush pointers from Adobe Photoshop or Adobe Photoshop Elements into GIMP. You simply have to copy the brush set files from Photoshop with the extension abr. You can find them in the Presets/ Brushes subdirectory of your Photoshop installation directory. Copy the file into the brushes folder in your GIMP installation. (The entire path in Windows is C:\Program\GIMP 2\share\gimp\2.0\brushes.)

There is large range of free Photoshop and GIMP brush presets available online. For example, GIMP brushes can be found at the GIMP community’s own website at www.gimpstuff.org. The website at blendfu.com provides GIMP and Photoshop brush sets sorted according to subjects and themes. If all these aren’t sufficient, you can always perform an Internet search for Photoshop/GIMP and brushes. But remember, installing large numbers of brushes can significantly slow down the program’s startup time!

Selecting the Clone Tool Options

Before you start editing your image, take a look at the Tool Options for the Clone tool. As mentioned earlier, these settings can be accessed in the bottom dock window of the Tools Options or by double-clicking the icon in the GIMP Toolbox.

The Clone tool options are as follows:

  • Mode: The Mode drop-down menu determines how the color is applied to the image and what effect it will have. If you choose Normal mode, color will be applied without elements being mixed or stacked from the underlying image background.
  • Opacity: Many paint tools offer the option of adjusting the opacity of the color or pattern. The Clone tool does too. The default setting is an opacity of 100%. The application of the color initially is opaque, with the exception of features such as a fuzzy edge of the brush pointer (Hardness). In some cases, you may need to use a semi-opaque painting technique to achieve the desired result. For example, you can set the opacity to 10% so that the color or structure will be translucent, which means that the colors and structures underneath will remain visible. Opacity allows you to apply a colored “glow” as well as produce seamless transitions.
  • Brush: You can access the Brushes selection window via this icon.
  • Size: The slide control and input box allow you to change the size of your paint brush.
  • Aspect Ratio: Adjusts the aspect ratio steplessly, for example to transform a circular brush into an elliptical one.
  • Angle: Rotates a brush tip (with a non-1:1 aspect ratio) around its center.
  • Dynamics: A selection of preset brushstroke attributes, such as Pressure Opacity, Fade Tapering and Random Color Dynamics options: A range of options for fine-tuning Dynamics settings
  • Fade out: Like any other tool with a brush pointer, the Clone tool can be used to make wiping strokes that fade out. If you click the Fade out check box to select it, the brush application will fade toward transparent. You can also select the length of the feathering effect.
  • Apply jitter: Initiates a slightly jittery line that looks like it’s hand-drawn.
  • Smooth stroke: Ensures even strokes when painting freehand.
  • Hard edge: Produces a hard, edgy result, even when you’re using brushes with feathering.
  • Source: Use this option to select whether the information to be cloned should be copied from the image (Image) or from a pattern in a palette (Pattern).
  • Alignment: None means that a point in the image will be used as selection area for application with the Clone tool. No matter where you apply the Clone tool, the information will be taken from the same image point.

    If you choose the Aligned option, you can first select a point in the image from which the information will be taken. You can then click on the area where you want the image information to be applied. The next time you want to apply image information somewhere else, the point for gathering image information is linked to the brush pointer at the same distance and angle as before. Thus, the Clone tool and its gathering point is wandering around the image while you work on it. If you want to change the origin of your clone, you simply select a new source by holding the Ctrl key and clicking the mouse.

    The Registered option requires at least two layers or two images, taking information from one layer or image and inserting it in the other. In both images, the tool’s starting point is the upper-left image corner. In Registered alignment mode, there is no offset between the point supplying information and the point where color is inserted.

    The Fixed mode lets you determine a point as the source of information. This point is fixed and you can cover entire surfaces with this image information.

Select the following Clone tool options:

  • Spacing: 100%
  • Mode: Normal
  • Dynamics: Nothing
  • Fade out: Nothing
  • Apply jitter: Nothing
  • Hard edge: Nothing
  • Source: Image
  • Alignment: Aligned

Leave the Brushes window open.

Using the Clone Tool for Touchup Work

Open the dustandscratches.png image and save it in your exercise folder.

Package icondustandscratches.png.zip

You’ll see the image window (with the sample image) and the Toolbox window. Select the Clone tool from the Toolbox. In the Tool Options window, select a brush with a soft edge (hardness 0.0). You’ll need a brush with a diameter of about 85 px to remove spots and one with a diameter of approximately 45 px to remove the dog-ear and the scratches.

Collecting Image Information and Adding It to the Image

The first step is to select the point from which the image information is to be copied so you can transfer it to the area with the flaw and correct it. Point the mouse cursor at an apt spot near a flaw. Press the Ctrl key and hold it down. The cursor will take the shape of a crosshair. Click the left mouse button on an unblemished area that resembles the area with the flaw while holding the Ctrl key down.

The image dustandscratches.png before the touchup.

Click on this spot to copy the data from the image. Release the mouse button first, and then the Ctrl key.

When you left-click on the flaw, the image information you just copied will be placed there. Point to another flaw and repeat the process. Since you have selected the Aligned option, the point from which the image information is taken will move with your Clone tool. Continue working until you need to copy new image data to correct flaws in different areas. Repeat the process (i.e., select a new point from which to copy information, press and hold down the Ctrl key, left-click, release the mouse button and Ctrl key, and then “stamp” out the flaw by left-clicking on it).

Changing Brush and View

The selected brush, 85 px, is ideal for removing spots along the wall and in the flower beds. If you want to remove the scratch or dog-ear in the upper-right corner, you should select a brush with a smaller pointer (say, 45 px) from the Brush section of the Tool Options window. Or you can simply scale the brush in the tool’s options.

In order to edit the scratched area more comfortably, use the Zoom tool (you can also call it up from the View > Zoom menu) to access a more detailed view of the area.

To transfer certain picture information with similar but undamaged content from one point to another, you have to be precise when you’re choosing the section in the picture and placing it on the damaged section. Make sure you choose and repair important sections with edges, contours, and distinctive elements first. Uniform surfaces are not as critical and don’t need precise picture information. They can be filled out easily.

Precise work is necessary to repair distinctive image elements.

Undoing a Step

The Undo (History) function was discussed earlier in section 1.5.5. If you inadvertently click on the wrong area, just use the Ctrl+Z keyboard shortcut (or choose Edit > Undo) to undo a step. In the image window under Edit > Preferences > Environment, you should have already defined the number of steps you can undo (Minimal number of undo levels).

You can also open the Undo History tab in the dialog dock or by choosing Windows > Dockable Dialogs > Undo History.

The image after the touchup.

The Healing Tool

The Healing tool is a relative of the Clone tool. It’s similar in how it’s handled and its settings, but it is for repairing minor blemishes.

With the same steps you used for the Clone tool, you can select a section that corresponds in color and structure with the area you want to repair. The difference is that the Healing tool takes the surrounding structure and brightness of the spot to repair into account. When you’re covering up a section of the image, the surrounding information has influence on the action and its result. Small defects in a uniform surface are easily covered up. The tool also works with larger surfaces; however, the characteristics of the blemished section are more likely to remain. A large bright spot will stay bright even if you paint over it with dark picture information. One countermeasure is to use a brush pointer that is slightly larger than the spot to heal.

Using the Healing tool is a simple and fast way to correct your image. Try it out and remove some wrinkles or other skin blemishes in a portrait.