24.5. Editing Images: Basics

24.5.1. 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. Making an image larger is much more problematic. Because of the nature of pixel graphics, quality is lost when an image is made larger. It is recommended to keep a copy of your original image before scaling or cropping.

24.5.1.1. 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 & Resize. Click a starting corner and drag to outline the area to keep.

A small window opens with information about the starting point and the size of the selected area. Adjust these values by clicking and dragging a corner of the crop box or by adjusting the values in the window. From Selection adjusts the crop to fit the current selection (selections are explained in Section 24.5.2. “Selecting Parts of Images”). Auto Shrink makes the crop smaller based on color changes in the image.

Press Cancel to abort the crop. Press Crop to crop the image. The results of Resize are identical to those of Change Canvas Size, described in Section 24.5.1.3. “Changing the Canvas Size”.

24.5.1.2. Scaling an Image

Select Image -> Scale Image to change the overall size of an image. Select the new size by entering it in New Width or New Height or by adjusting the Ratio. To change the proportions of the image when scaling (this distorts the image), click the chain icon to the right of the ratio fields to break the link between them. When those fields are linked, all values are changed proportionately when the value in one of the four fields is changed. When the link is broken, width and height can be adjusted independently of each other or the X and Y ratios can be adjusted individually.

The values in the Print Size are independent of the pixel size. In that section, modify the image resolution by modifying the resulting image size when printed or modifying the resolution itself. Use the unit drop-down boxes to change the measuring unit.

Interpolation is an expert option that controls the scale method. When finished adjusting the size, press OK to scale the image. Reset restores the original values. Cancel aborts the procedure.

24.5.1.3. 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 to the right of Ratio. Enter the desired size in the height and width fields or adjust the ratios.

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 OK to change the canvas size. Click Reset to restore the original values or Cancel to cancel the canvas resize.

[Tip]Tip

The same results can be achieved using the Resize option of the crop tool.

24.5.2. 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.

24.5.2.1. Using the Select Tools

The main select 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 select tools, determine whether the selection should replace, be added to, be subtracted from, or intersect with an existing selection.

Rectangular Select

This tool can be used to select rectangular or square areas. In the tool options, select among Free Select, Fixed Size, and Fixed Aspect Ratio to control the shape and size of the selection.

Elliptical Select

Use this to select elliptical or circular areas. The same options are available as with rectangular selection.

Lasso

Draw a selection area freehand with this tool by dragging the mouse over the image with the left mouse button pressed. The end points will be connected with a straight line when you release the tool. The area inside is then selected.

Magic Wand

This tools selects a region based on color similarities.

By Color

With this, select all the pixels in the image with the same color as the clicked pixel.

Intelligent Scissors

Click a series of points in the image. As you click, the points are connected based on color differences.

24.5.2.2. 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 (freehand 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 unselects 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.

[Tip]Tip

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 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.

24.5.3. 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 an area will be painted.

24.5.3.1. Selecting Colors

By default, paint tools use the foreground color. However, this can be changed in the tool options of fill tools. To select the color, first click the display box of the foreground or background color, as desired.

A dialog with four tabs opens. These tabs provide different color selection methods. Only the first tab, shown in Figure 24.2. “The Basic Color Selector Dialog”, is described here. The new color is shown in Current. The previous color is shown in Old.

Figure 24.2. The Basic Color Selector Dialog

The Basic Color Selector Dialog

The easiest way to select a color is 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 saving 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 Hex Triplet.

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 color picker tool, the icon for which resembles an eye dropper. 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.

24.5.3.2. 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.

24.5.3.3. 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 on a special layer. To work with the image after adding text, read Section 24.6.1. “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.

24.5.3.4. 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 Non Aligned (the default setting), the source resets to the original when you release the left mouse button.

24.5.4. 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 The GIMP, but better results can be obtained by adjusting the color levels.

To do this, select Layer -> 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 black, gray, and white points from the image itself.

To modify a channel individually, select the desired channel in Modify Levels for Channel. Then drag the black, white, and middle markers in the slider in Input Levels. Alternatively, 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 how the image would look with the modifications applied. When the desired result is achieved, press OK to apply the changes. With Resest, restore the original settings. Cancel aborts level adjustment.

24.5.5. Undoing Mistakes

Most modifications made in The 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 toolbox menu with File -> Dialogs -> Undo History.

The dialog shows a base image and a series of editing changes that can be undone. Use the yellow arrow at the bottom left to undo changes. Use the green arrow at the right to redo an undone change. 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.