Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Mail Systems
Eclipse Documentation

How To Guides
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Problem Solutions




4.5.  Removing Unwanted Objects from an Image

There are two kinds of objects you might want to remove from an image: first, artifacts caused by junk such as dust or hair on the lens; second, things that were really present but impair the quality of the image, such as a telephone wire running across the edge of a beautiful mountain landscape.

4.5.1.  Despeckling

A good tool for removing dust and other types of lens grunge is the Despeckle filter, accessed as Filters->Enhance->Despeckle from the image menu. Very important: to use this filter effectively, you must begin by making a small selection containing the artifact and a small area around it. The selection must be small enough so that the artifact pixels are statistically distinguishable from the other pixels inside the selection. If you try to run despeckle on the whole image, you will hardly ever get anything useful. Once you have created a reasonable selection, activate Despeckle, and watch the preview as you adjust the parameters. If you are lucky, you will be able to find a setting that removes the junk while minimally affecting the area around it. The more the junk stands out from the area around it, the better your results are likely to be. If it isn't working for you, it might be worthwhile to cancel the filter, create a different selection, and then try again.

If you have more than one artifact in the image, it is necessary to use Despeckle on each individually.

4.5.2.  Garbage Removal

The most useful method for removing unwanted “clutter” from an image is the Clone tool, which allows you to paint over one part of an image using pixel data taken from another part (or even from a different image). The trick to using the clone tool effectively is to be able to find a different part of the image that can be used to “copy over” the unwanted part: if the area surrounding the unwanted object is very different from the rest of the image, you won't have much luck. For example, if you have a lovely beach scene, with a nasty human walking across the beach who you would like to teleport away, you will probably be able to find an empty part of the beach that looks similar to the part he is walking across, and use it to clone over him. It is quite astonishing how natural the results can look when this technique works well.

Consult the Clone Tool Help for more detailed instructions. Cloning is as much an art as a science, and the more you practice at it, the better you will get. At first it may seem impossible to produce anything except ugly blotches, but persistence will pay off.

In some cases you may be able to get good results by simply cutting out the offending object from the image, and then using a plug-in called “Resynthesizer” to fill in the void. This plug-in is not included with the main GIMP distribution, but it can be obtained from the author's Resynthesizer web site. As with many things, your mileage may vary.

4.5.3.  Removing Red-eye

When you take a flash picture of somebody who is looking directly toward the camera, the iris of the eye can bounce the light of the flash back toward the camera in such a way as to make the eye appear bright red: this effect is called “red eye”, and looks very bizarre. Many modern cameras have special flash modes that minimize red-eye, but they only work if you use them, and even then they don't always work perfectly. Interestingly, the same effect occurs with animals, but the eyes may show up as other colors, such as green.

GIMP does not include a special tool for removing red-eye, but it isn't all that hard to do. Basically the idea is to zoom the area around the eye so that it is nice and large and easy to work with; then make a selection of the red part of the eye and a bit of the area around it; feather the selection so that you don't create sharp-looking edges; and finally desaturate the red channel inside the selection using one of the color tools---Levels, Curves, or Hue/Saturation. It takes a little practice the first few times, but once you have the technique mastered, you should be able to quickly and easily create quite a natural looking eye color.

If you would like a more automated approach, you can try downloading a recently created redeye plug-in from the GIMP Plug-in Registry. We have not received any feedback so far about how well it works. It comes in source code form, so you will need to be able compile it in order to use it. (See Installing New Plug-ins for information on how to do this.)

  Published under the terms of the GNU General Public License Design by Interspire