Editing Images

GIMP provides a number of tools for making changes to images. The functions described here are those most interesting for home users.

Changing the Image Size

Once an image is scanned or a digital photograph is loaded from the camera, it is often necessary to modify the size for display on a Web page or for printing. Images can easily be made smaller either by scaling them down or by cutting off parts of them. Enlarging an image is much more problematic. Because of the nature of raster graphics, quality is lost when an image is enlarged. It is recommended to keep a copy of your original image before scaling or cropping.

Cropping an Image

Cropping an image works like cutting the edges off a piece of paper. Select the crop tool from the toolbox (it resembles a scalpel) or with Tools+Transform Tools+Crop. Click a starting corner and drag to outline the area to keep.

A rectangle showing the crop area will appear. To adjust the size of the rectangle, move your mouse pointer above any of the rectangle's sides or corners, click and drag to resize as desired. If you want to adjust both width and height of the rectangle, use a corner. To adjust only one dimension, use a side. To move the whole rectangle to a different position without resizing, click anywhere near its center and drag to the desired position.

When you are satisfied with the crop area, click anywhere inside to crop the image or press Enter. To cancel the cropping, click anywhere outside the crop area.

Advanced options for the crop tool are available in the Tool Options dialog.

Scaling an Image

Select Image+Scale Image to change the overall size of an image. Select the new size by entering it in Width or Height. To change the proportions of the image when scaling (this distorts the image), click the chain icon to the right of the fields to break the link between them. When those fields are linked, all values are changed proportionately. Adjust the resolution with X resolution and Y resolution.

The Interpolation option controls the quality of the resulting image. The default Cubic interpolation method is a good standard to use in most cases.

When finished adjusting the size, press Scale to scale the image. Reset restores the original values. Cancel aborts the procedure.

Changing the Canvas Size

Changing the canvas size is like putting a mat around an image. Even if the mat is smaller, the rest of the image is there, but you can only see part of it. If the mat is larger, you see the original image with extra space around it. To do this, select Image+Canvas Size.

In the dialog that opens, enter the new size. By default, the width and height maintain the same proportions as the current image. To change this, click the chain icon.

After adjusting the size, determine how the existing image should be positioned in comparison to the new size. Use the Offset values or drag the box inside the frame at the bottom. When satisfied with the changes, click Resize to change the canvas size. Click Reset to restore the original values or Cancel to cancel the canvas resize.

Selecting Parts of Images

It is often useful to perform an image operation on only part of an image. To do this, the part of the image with which to work must be selected. Areas can be selected using the select tools available in the toolbox, using the quick mask, or combining different options. Selections can also be modified with the items under Select. The selection is outlined with a dashed line, called marching ants.

Using the Selection Tools

The main selection tools are rather easy to use. The paths tool, which can also be used for more than selecting, is more complicated so is not described here. In the tool options for the other selection tools, use one of the icons in the Mode row to determine whether the selection should replace, be added to, be subtracted from, or intersect with an existing selection.

Rect Select

This tool can be used to select rectangular or square areas. To select an area with a fixed aspect ratio, width, height or size, activate the Fixed option and choose the relevant mode in the Tool Options dialog. To create a square, hold Shift while selecting a region.

Ellipse Select

Use this to select elliptical or circular areas. The same options are available as with the rectangular selection. To create a circle, hold Shift while selecting a region.

Free Select (Lasso)

With this tool, you can create a selection based on a combination of freehand drawing and polygonal segments. To draw a freehand line, drag the mouse over the image with the left mouse button pressed. To create a polygonal segment, release the mouse button where the segment should start and press it again where the segment should end. To complete the selection, hover the pointer above the starting point and click inside the circle.

Fuzzy Select (Magic Wand)

This tools selects a continuous region based on color similarities. Set the maximum difference between colors in the tool options dialog in Threshold. By default, the selction is based only on the active layer. To base the selection on all visible layers, check Sample merged.

Select by Color

With this, select all the pixels in the image with the same or similar color as the clicked pixel. The maximum difference between colors can be set in the tool options dialog in Threshold. The important difference between this tool and Fuzzy Select is that Fuzzy Select works on continuous color areas while Select by Color selects all pixels with similar colors in the whole image regardless of their position.

Intelligent Scissors

Click a series of points in the image. As you click, the points are connected based on color differences. Click on the first point to close the area. Convert it to a regular selection by clicking inside it.

Foreground Selection Tool

The Foreground Selection tool lets you semiautomatically select an object in a photograph with minimal manual effort.

If you want to use the Foreground Selection tool, follow these steps:

  1. Activate the Foreground Selection tool by clicking on its icon in the Toolbox or choosing Tools+Selection Tools+Foreground Select from the menu.

  2. Roughly select the foreground object you want to extract. Select as little as possible from the background but include the whole object. At this point, the tool works like the Fuzzy Select tool.

    When you release the mouse button, the non selected part of the image is covered with dark blue mask.

  3. Draw a continuous line through the foreground object going over colors which will be kept for the extraction. Do not paint over background pixels.

    When you release the mouse button, all background is covered with dark blue mask. If parts of the object are also masked, paint over them. The mask will adapt.

  4. When you are satisfied with the mask, press Enter. The mask will be converted to a new selection.

Using the Quick Mask

The quick mask is a way of selecting parts of an image using the paint tools. A good way to use it is to make a rough selection using the intelligent scissors or the lasso (the free selection tool). Then activate the quick mask by pressing the small icon with the dashed box in the lower left corner.

The quick mask displays the selection using an overlay of red. Areas shaded with red are not selected. Areas appearing as they did before the mask was activated are selected. To modify the selection, use the paint tools. Painting with white selects the painted pixels. Painting with black deselects pixels. Shades of gray (colors are treated as shades of gray) are a partial selection. Partial selection allows smooth transitions between selected and unselected areas.

To use a different color for displaying the quick mask, right-click the quick mask button then select Configure Color and Opacity from the menu. Click the colored box in the dialog that opens in order to select a new color.

After using the paint tools to adjust the selection as desired, convert from the quick mask view back to the normal selection view by clicking the icon in the lower left corner of the image window (currently displaying a red box). The selection is again displayed with the marching ants.

Applying and Removing Color

Most image editing involves applying or removing color. By selecting a part of the image, limit where color can be applied or removed. When you select a tool and move the cursor onto an image, the cursor's appearance changes to reflect the chosen tool. With many tools, an icon of the current tool is shown along with the arrow. For paint tools, an outline of the current brush is shown, allowing you to see exactly where you will be painting in the image and how large of an area will be painted.

Selecting Colors

Paint tools use the foreground color. To select the color, first click the display box of the foreground color in the Toolbox. A dialog with five tabs opens. These tabs provide different color selection methods. Only the first tab, shown in Figure 16.2, “The Basic Color Selector Dialog”, is described here. The new color is shown in Current. The previous color is shown in Old.

Figure 16.2. The Basic Color Selector Dialog

The Basic Color Selector Dialog

The easiest way to select a color is by using the colored areas in the boxes to the left. In the narrow vertical bar, click a color similar to the desired color. The larger box to the left then shows available nuances. Click the desired color. It is then shown in Current. If that color is not what you want, try again.

The arrow button to the right of Current enables the saving of a number of possible colors. Click the arrow to copy the current color to the history. A color can then be selected by clicking it in the history. A color can also be selected by directly entering its hexadecimal color code in HTML Notation.

The color selector defaults to selecting a color by hue, which is usually easiest for a new user. To select by saturation, value, red, green, or blue, select the corresponding radio button to the right. The sliders and number fields can also be used to modify the currently selected color. Experiment a bit to find out what works best for you.

When the desired color is shown in Current, click OK. To restore the original values shown when the dialog was opened, click Reset. To abort changing the color, click Cancel.

To select a color that already exists in your image, use the eye dropper tool. With the tool options, set whether the foreground or background color should be selected. Then click a point in the image that shows the desired color. When the color is right, click Close to close the tool's dialog.

Painting and Erasing

To paint and erase, use the tools from the toolbox. There are a number of options available to fine-tune each tool. Pressure sensitivity options apply only when a pressure-sensitive graphics tablet is used.

The pencil, brush, airbrush, and eraser work much like their real-life equivalents. The ink tool works like a calligraphy pen. Paint by clicking and dragging. The bucket fill is a method of coloring areas of an image. It fills based on color boundaries in the image. Adjusting the threshold modifies its sensitivity to color changes.

Adding Text

With the text tool, easily add text to an image. With the tool options, select the desired font, font size, color, justification, indent, and line spacing. Then click a starting point in the image. A small dialog opens in which to enter your text. Enter single or multiple lines of text then press Close.

The text tool creates text in a special layer. To work with the image after adding text, read Section 16.5.6, “Layers”. When the text layer is active, it is possible to modify the text by clicking in the image to reopen the entry dialog. Change the settings by modifying the tool options.

Retouching Images—The Clone Tool

The clone tool is ideal for retouching images. It enables you to paint in an image using information from another part of the image. If desired, it can instead take information from a pattern.

When retouching, it is usually a good idea to use a small brush with soft edges. In this way, the modifications can blend better with the original image.

To select the source point in the image, press and hold Ctrl while clicking the desired source point. Then paint with the tool, as usual. When you move the cursor while painting, the source point, marked by a cross, moves as well. If the Alignment is set to None (the default setting), the source resets to the original when you release the left mouse button.

Adjusting Color Levels

Images often need a little adjusting to get ideal print or display results. In many programs designed for inexperienced users, the brightness and contrast levels are modified. This can work and is also available in GIMP, but better results can be obtained by adjusting the color levels.

To do this, select Colors+Levels. A dialog opens for controlling the levels in the image. Good results can usually be obtained by clicking Auto. To make manual adjustments to all channels, use the dropper tools in All Channels to pick areas in the image that should be black, neutral gray, and white.

To modify a channel individually, select the desired channel in Channel. Then drag the black, white, and middle markers in the slider in Input Levels. Conversely, use the dropper tools to select points in the image that should serve as the white, black, and gray points for that channel.

If Preview is checked, the image window shows a preview of the image with the modifications applied. When the desired result is achieved, press OK to apply the changes. With Reset, restore the original settings. Cancel aborts level adjustment.

Undoing Mistakes

Most modifications made in GIMP can be undone. To view a history of modifications, use the undo dialog included in the default window layout or open one from the image window menu with Windows+Dockable Dialogs+Undo History.

The dialog shows a base image and a series of editing changes that can be undone. Use the buttons to undo and redo changes. In this way, you can work back to the base image. If you undo a modification then make a new one, the undone modification cannot be redone.

Changes can also be undone and redone with the Edit menu. Alternatively, use the shortcuts Ctrl+Z and Ctrl+Y.

Layers

Layers are a very important aspect of GIMP. By drawing parts of your image on separate layers, change, move, or delete those parts without damaging the rest of the image. To understand how layers work, imagine an image created from a stack of transparent sheets. Different parts of the image are drawn on different sheets. The stack can be rearranged, changing which parts are on top. Individual layers or groups of layers can shift position, moving sections of the image to other locations. New sheets can be added and others set aside.

Use the Layers dialog to view the available layers of an image. The text tool automatically creates special text layers when used. The active layer is highlighted. The buttons at the bottom of the dialog offer a number of functions. More are available in the menu opened when a layer is right-clicked in the dialog. The two icon spaces before the image name are used for toggling image visibility (eye icon when visible) and for linking layers. Linked layers are marked with the chain icon and moved as a group.

Image Modes

GIMP has three image modes—RGB, Grayscale, and Indexed. RGB is a normal color mode and is the best mode for editing most images. Grayscale is used for black-and-white images. Indexed limits the colors in the image to a set number. It is mainly used for GIF images. If you need an indexed image, it is normally best to edit the image in RGB then convert to indexed right before saving. If you save to a format that requires an indexed image, GIMP offers to index the image when saving.

Special Effects

GIMP includes a wide range of filters and scripts for enhancing images, adding special effects to them or making artistic manipulations. They are available in Filters. Experimenting is the best way to find out what is available.