Frequently an image that otherwise looks good has a small flaw. The flaw can be dust on the lens, a car that drives unexpectedly into the frame, or a traffic sign that is inconveniently located. Inconspicuous removal of areas in images is one of the most frequent issues that arise. A good result depends on knowing the right tricks, having suitable plugins, and not needing to rely so heavily on the more archaic Eraser tool.
Because these problems occur often, you have an entire palette of options for removing troublesome areas as inconspicuously and seamlessly as possible. Gimp offers a series of tools, and special plugins expand these capabilities. The G'MIC plugin collection contains filters for editing out these types of problems.
The basic solution always involves the same approach: The editor responds by trying more or less to cover the problem part of the image automatically to create the impression of a homogeneous area. The simplest way to do this is with a Clone tool. Gimp has three of these, and they all work pretty much alike.
It is a good idea to observe the procedure one time in detail, because it serves as the basis for all additional procedures I describe here. In the future, the process will change fundamentally. Light field cameras [1], for instance, can provide data sets that make it possible to replace unwanted areas completely.
Figure 1 shows the problems that come with cloning. To the left is the original image. To the right is the result after cloning. You should first select a source area by clicking while pressing the Ctrl key; then, use the Clone tool like a standard paint tool and edit the selected area.
Although a very soft brush point was used in the example, the result does not look realistic for several reasons: The material suitable for cloning is very limited in scope, and the tool point is so large that it covers the middle of the area to be corrected.
The possibility of working with a small point does exist, but this would require a level of precision usually only possessed by experienced users. The application of color has to match the current pattern exactly. With the tool parameter Alignment: None , Gimp uses the same starting position for removing the colors and often makes the work easier.
The second problem is unfortunately more of an issue. The structure of the checkered flower is a real challenge to repair because even a small mistake can create clearly visible artifacts on the edges. The argument could be made that this is a special case that arises only infrequently and therefore does not necessarily call for a filter. However, in reality, these kinds of problems occur fairly frequently. The fur on the donkey in Figure 2 likewise has a regular structure, as do things like fields and ripples on waves in nature. In all of these motifs, a small mistake stands out like a sore thumb.
To edit out the barbed wire in Figure 2, you would not ordinarily use the standard Clone tool. Instead, the better choice would be the so-called Heal tool. It is very similar to the Clone tool, but it takes the value for the brightness of the environment into account when applying color.
As a rule, this gives better results with fewer visible aberrations. This rule holds as long as two conditions are fulfilled: You should choose a soft brush point that is larger than the area to be corrected, and you should move the tool with small, short motions or clicking or daubing strokes.
Removing brightness at the edges of the area that is to be corrected works better when the image contains a greater number of gradients of brightness. If you are working with RAW images, these corrections are already easier in the RAW converter.
Gimp has extensions for almost every area of application you can think of. These extensions come primarily in the form of scripts and plugins. Resynthesizer is an incredibly powerful add-on that is used in cloning. In his dissertation, the developer of Resynthesizer Paul Harrison describes it as a "texture synthesis" algorithm [2]. Additional information on this and similar procedures is found at Logarithmic.net [3].
In Ubuntu you can install it with
sudo apt install gimp-plugin-registry
Many other distributions offer the Resynthesizer plugin as a package in their repositories. Often these packages already contain scripts that make the expanded functions accessible. Alternatively, you can download the almost 70KB tarball from Resynthesizer at the Gimp Plugin Registry [4]. You unpack the compiled program, copy it either to the ~/.gimp-2.8/plug-ins/ or /usr/lib/gimp/2.0/plug-ins/ directory, and then you restart the graphics program.
Resynthesizer comes as a binary plugin and it displays some astounding properties. It lets you remove a selection (Filters | Enhance | Heal selection ) and also repair transparent areas (Filters | Enhance | Heal transparency ).
When you choose Filters | Enhance | Uncrop , the plugin enlarges images and fills in the transparent edges. Additionally, you can create larger textures out of small pieces. With Filters | Map | Style you can transfer the style applied in one image to another. Filters | Enhance | Enlarge & sharpen makes it possible to enlarge and sharpen an image simultaneously.
Figure 3 shows the plugin options, which you can bring up by selecting Filters | Map | Resynthesize . It provides access to all functions and is therefore complex.
Once installed, the tool appears in Filters | Enhance | Heal selection , as well as under Filters | Map | Resynthesize . The tool is very easy to access thanks to multiple menu entries.
To remove areas from an image, make a selection and then call Heal selection . Depending on the distribution and installation, you see one of the two dialogs in Figure 4. The parameters are largely self-explanatory. If you see the second version of the dialog, you can experiment with Filling order , which refers to the order of filling, and Sample from , which you use to define the origin of the material.
If you are not getting the results you want, you can do two things: either recall the function with Ctrl+F and check to see what has changed or change the selection. Sometimes it helps to move the selection somewhat or modify its size to achieve better results.
The Heal selection filter can also restore corners of images that are often be lost when "stitching" a panorama together. It occurs because information is missing in the relevant areas. Figure 5 illustrates the problem. The panorama does not have individual images that can provide information about the corners. Even so, Resynthesizer can compute these relatively well.
You can also use G'MIC plugins [5] to tackle problems associated with the removal of image areas. However, the corresponding filters are still not well documented.
Because G'MIC is pre-compiled, you can install it in a jiffy. The software comes in two versions: a standalone program that runs on the command line, even without Gimp, and a Gimp plugin, which you save to the plugin directory, as you did the Resynthesizer tool. Numerous distributions also offer suitable packages with names like gmic for the standalone program and gimp-gmic for the plugin version.
Ubuntu users can install the plugin with:
sudo apt install gimp-gmic
"Inpainting" is largely a restoration procedure that seamlessly covers selected areas with other areas [6]. In certain respects, the methods applied are similar to those of the Resysnthesizer tool. However, in practice, the use and the results are different for each tool. G'MIC currently offers no fewer than five versions of the procedure under Filters | G'MIC | Repair :
Each of these methods has distinct advantages and disadvantages. The example shown in Figure 6 illustrates the performance capability of Inpaint [holes] . This filter closes the gap in the checkered flower completely after a few repetitions. The result is so good that the outcome is very difficult to distinguish from the original.
At times, you need to get creative. In this example, the filter was applied experimentally with default settings. It did not completely cover the hole. The newly created layer was blended into the original layer via Layer | Merge Down and the layer was used again. Increased values for Tolerance and Maximal area then closed the rest of the hole.
Another method that has barely been documented but that achieves surprisingly good results (Figure 7) uses Inpaint [patch-based] . This method works directly on the image to be restored and lets you mark the areas that need editing with color (Mask color ). The filter replaces the marked areas immediately with small insert pieces from the environment that the plugin selects in such a way that the structure is maintained.
Many of the methods discussed let you remove pieces of almost any image without creating visible artifacts. However, your level of experience and significant manual work can sometimes determine outcomes. In most cases, however, you can expect very good results from simple procedures. The plugins expand the reach of Gimp with a large variety of features, making it comparable to commercial programs.
Infos