3.10.  Clone Tool

Figure 12.35.  Clone tool icon in the Toolbox

Clone tool icon in the Toolbox

The Clone tool uses the current brush to copy from an image or pattern. It has many uses: one of the most important is to repair problem areas in digital photos, by "painting over" them with pixel data from other areas. This technique takes a while to learn, but in the hands of a skilled user it is very powerful. Another important use is to draw patterned lines or curves: see Patterns for examples.

If you want to clone from an image, instead of a pattern, you must tell GIMP which image you want to copy from. You do this by holding down the Ctrl key and clicking in the desired source image. Until you have set the source in this way, you will not be able to paint with the Clone tool: the tool cursor tells you this by showing a “forbidden” symbol.

If you clone from a pattern, the pattern is tiled; that is, when the point you are copying from moves past one of the edges, it jumps to the opposite edge and continues, as though the pattern were repeated side-by-side, indefinitely. When you clone from an image this does not happen: if you go beyond the edges of the source, the Clone tool stops producing any changes.

You can clone from any drawable (that is, any layer, layer mask, or channel) to any other drawable. You can even clone to or from the selection mask, by switching to QuickMask mode. If this means copying colors that the target does not support (for example, cloning from an RGB layer to an Indexed layer or a layer mask), then the colors will be converted to the closest possible approximations.

3.10.1.  How to Activate

You can activate the Clone tool in several ways :

  • From the image menu through ToolsPaint ToolsClone.

  • By clicking on the tool icon in Toolbox.

  • By pressing the c keyboard shortcut.

3.10.2.  Key modifiers

See the Brush Tools Overview for a description of key modifiers that have the same effect on all brush tools.

Ctrl

The Ctrl key is used to select the source, if you are cloning from an image: it has no effect if you are cloning from a pattern. You can clone from any layer of any image, by clicking on the image display, with the Ctrl key held down, while the layer is active (as shown in the Layers dialog). If Alignment is set to “Non-aligned” or “Aligned” in Tool Options, then the point you click on becomes the origin for cloning: the image data at that point will be used when you first begin painting with the Clone tool. In source-selection mode, the cursor changes to a crosshair-symbol.

3.10.3.  Tool Options

Figure 12.36.  Tool Options for the Clone tool

Tool Options for the Clone tool

Opacity; Mode; Brush; Pressure Sensitivity, Fade out, Hard Edges
[Note] Note

See the Brush Tools Overview for a description of tool options that apply to many or all brush tools.

Pattern

Clicking on the pattern symbol brings up the Patterns dialog, which you can use to select the pattern to paint with. This option is only relevant if you are cloning from a Pattern source.

Source

The choice you make here determines whether data will be copied from the pattern shown above, or from one of the images you have open. If you choose “Image source”, you must tell GIMP which layer to use as the source, by Ctrl-clicking on it, before you can paint with the tool.

Alignment

The Alignment mode sets how the source position is offset from each brush stroke.

Figure 12.37.  Alignement modes

Alignement modes

Non-aligned

Alignement modes

Aligned

Alignement modes

Registered


Above: schematic illustration of the three possible alignment modes. The mouse cursor is shown as a red rectangle, and the source point as a black crosshair.

Non-aligned

In this mode, each brushstroke is treated separately. For each stroke, the point where you first click is copied from the source origin; there is no relationship between one brush stroke and another. In non-aligned mode, different brush strokes will usually clash if they intersect each other.

Aligned

In this mode, the first click you make when painting sets the offset between the source origin and the cloned result, and all subsequent brushstrokes use the same offset. Thus, you can use as many brushstrokes as you like, and they will all mesh smoothly with one another.

If you want to change the offset, you can do this by switching to non-aligned mode, painting one stroke, then switching back to aligned mode. Subsequent strokes will use the same offset as the first stroke.

Registered

This mode copies each pixel in the source to the pixel with the same offset in the target. It is most commonly useful when you want to clone from one layer to another layer within the same image. It is also useful when cloning from a pattern, if you want the left or upper edges of the pattern to line up precisely with the corresponding edges of the target layer.

3.10.4.  Further Information

Transparency

The effects of the Clone tool on transparency are a bit complicated. You cannot clone transparency: if you try to clone from a transparent source, nothing happens to the target. If you clone from a partially transparent source, the effect is weighted by the opacity of the source. So, assuming 100% opacity and a hard brush:

  • Cloning translucent black onto white produces gray.

  • Cloning translucent black onto black produces black.

  • Cloning translucent white onto white produces white.

  • Cloning translucent white onto black produces gray.

Cloning can never increase transparency, but, unless “keep transparency” is turned on for the layer, it can reduce it. Cloning an opaque area onto a translucent area produces an opaque result; cloning a translucent area onto another translucent area causes an increase in opacity.

Filter” brushes

There are a few non-obvious ways to use the Clone tool to obtain powerful effects. One thing you can do is to create “Filter brushes”, that is, create the effect of applying a filter with a brush. To do this, duplicate the layer you want to work on, and apply the filter to the copy. Then activate the Clone tool, setting Source to “Image source” and Alignment to “Registered”. Ctrl-click on the filtered layer to set it as the source, and paint on the original layer: you will then in effect be painting the filtered image data onto the original layer.

History brush

You can use a similar approach to imitate Photoshop's “History brush”, which allows you to selectively undo or redo changes using a brush. To do this, start by duplicating the image; then, in the original, go back to the desired state in the image's history, either by undoing or by using the Undo History dialog. (This must be done in the original, not the copy, because duplicating an image does not duplicate the Undo history.) Now activate the Clone tool, setting Source to “Image source” and Alignment to “Registered”. Ctrl-click on a layer from one image, and paint on the corresponding layer from the other image. Depending on how you do it, this gives you either an “undo brush” or a “redo brush”.