The Quick Start Guide to the GIMP, Part Four

Our series winds up with a detailed description of the toolbox, plug-ins and keyboard acceleration.

Last month we talked about the Image Window and Layers, two very important topics when learning about the GIMP. Image Windows are where image processing work is displayed and where you pick the elements of the image to be worked on. Layers provide even more control over those selections. This month we take a look at the Toolbox, the set of buttons that drives most of the major processing tools, including various styles of selections. We also look at using text and filters, and briefly discuss scripting.

The Toolbox

The most recent developer's release of the GIMP used for this article included a more compact version of the Toolbox than earlier versions. None of the tools were dropped, but the excess blank areas in the buttons and menu bar were removed. This saves some screen space on smaller displays, although I found it a little hard, with my aging eyes, to make out some of the buttons on an 1152x900 display. Keep in mind that most tools and many features in the GIMP are also accessible via keyboard accelerators, also known as keyboard shortcuts. I'll only mention a few, but take note of them when you experiment, as they help speed your work tremendously.

Figure 1. The Toolbox

The Toolbox is made up of buttons set in a seven row by three column box, with a menu bar at the top and a foreground/background color selection box at the bottom. The menu bar holds a File menu similar to the one in the Image Window (although with fewer options) and an Extensions menu. The latter allows you access to the Script FU scripting interface. We'll get to that a little later. The tools are selected by a single left-button mouse click over the appropriate button. A double click opens the Tool Options dialog window that provides access to configurable options for the selected tool, if any are available.

Figure 2. Selection Tools

The first row of buttons and the first two buttons in the second row are the Selection Tools: Rectangular, Elliptical, Free Hand, Fuzzy and Bezier. Rectangular and Elliptical draw the respective type of outline as you drag the cursor, left mouse button down, around the Image Window. Holding the shift key down while dragging will form a uniform box or circle. Free Hand will draw an outline which follows the path of the cursor as you drag it. Note that when you release the mouse button while working with the Free Hand selection, the selection is closed between the starting point and ending point of the cursor's path. The Fuzzy select will select a region of an image based on the colors in the region where you click with the left mouse button. This sort of selection works best for images that do not contain gradients or wide ranges of colors over very small areas. The Bezier selection tool allows a region to be outlined in precise detail. The Bezier tool was used to select points on the outline of the monitors (after each point was selected, a straight line was drawn connecting the last two points) on the cover of the November issue, back when part one of this series ran. Once a complete outline is selected, a single click on the inside of the selected region activates that region and the marching ants began their dance around the selection's outline. Bezier selections can also be used to select outlines of very jagged regions, but the method for doing so is beyond the scope of this article. Note that all the Selection Tools have configurable options. They all support anti-aliasing and user-defined feathered regions.

The third button on the second row is the Intelligent Scissors button. At the time of this writing that feature was not yet supported.

Figure 3. Move, Magnify and Crop Tools

The third row of buttons holds the Move, Magnify and Crop tools. The Move Tool allows a selected region or regions to be moved. The Move tool is more sophisticated than it might seem at first. When used with the Layers and Channels dialog, it becomes possible to select various pieces of an image to adjust them within the framework of the complete image.

The Magnify Tool is used to zoom in and out of the image. This is useful for finding the edges of nearby objects in an image. At times, you might bucket-fill a region only to find the fill process covered more of the image than you expected. Using the zoom tool might show that a tiny region of the fill area is not enclosed by colors different from the fill region, indicating that the fill process “leaked” into adjoining regions.

The Crop tool selects a region by boxing it out; hold down the left mouse button, drag and release to select a region. A dialog box will open giving the dimensions of the selected region. At this point the region can be cropped; that is, the area outside the boxed region is discarded and the Image Window is resized to the area defined by the Crop Tool. All Layers are cropped to the new dimension. Note that there are image filters which can also perform various forms of cropping.

Figure 4. Transform and Other Tools

Button one in row four is the Transform Tool. Select a region or layer of the image and then click on the Transform Tool button. Next, click inside the selected region or layer. The area will be outlined with a rectangle and the corners will be outlined with small, wireframe boxes. By default, the Transform Tool is configured to perform rotations on the selected region. Double clicking the Transform Tool button brings up the Tool Options dialog where you can select one of Rotate, Scale, Shear or Perspective for the selected region or layer. Scaling will work with any selected area but be aware that scaling of text can, if enlarged too much, cause aliasing (jagged edges) to occur. Click, hold and drag the mouse inside the selected region in order to perform the current transform.

The middle button of row four is the Flip tool. Click on this button to flip a layer, image or selected region either horizontally or vertically. The Tool Options dialog for this tool provides the mechanism for selecting the direction of the flip. A flip reverses the pixels of the area to be flipped—the rightmost pixels end up on the leftmost side in a horizontal flip, and the topmost pixels end up at the bottom in a vertical flip.

On the outside of the fourth row is the Text Tool. Clicking once on this tool will enable the tool, but you need to click inside an Image Window to bring up the Text Tool dialog. This dialog is used to select the font characteristics of the text you wish to insert in the image. The color of the text will match the current foreground color, so be sure you have set the foreground color (described in a later section on Colors) before clicking on the OK button in the Text Tool dialog. Once you click on OK, the Text Tool dialog closes, and the text is inserted in the image with the marching ants (if enabled) dancing around the edges of the text. At this point you can click on the Move Tool to move the text to the desired location. Once you're familiar with the GIMP, you'll find that it's not necessary to click on the Move Tool. However, when first starting out, it's important to be familiar with the current mode of GIMP operation by explicitly selecting the Tool of interest.

An important note about adding text: text is inserted into an image as a floating selection. Floating selections have their own, temporary layer in the Layers and Channels dialog. They require the user to select a disposition for them before any further work can be done on other layers. A floating selections disposition can be one of “Anchor” or “New”. Anchoring a layer composites it with the current layer. Marking a floating selection as a new layer adds it to the top of the set of layers that make up the current image.

The next row is made up of the Color Picker Tool, the Bucket Fill Tool and the Blend Tool from left to right. Colors in the GIMP can be selected through the use of the Color Selection dialog which allows fairly detailed selection of the Red, Green and Blue levels along with HSV (hue, saturation and value) levels. However, if you need to use a color that already exists in your image, the Color Picker Tool, which resembles an eye dropper, is a much quicker way to set the foreground color to the desired color. Click on the Tool's button and then move the mouse over the pixel in the image window which contains the color you wish to use. Important note: be sure the layer in which that pixel lives is currently active. When you click in the image window the foreground color is set to the color of the pixel over which the mouse sits. The foreground color's setting is shown in the box at the bottom of the Toolbox. The two large boxes represent the current foreground (upper left) and background (lower right) colors.

Filling a region of the image with either a solid color or a pattern can be done using the Bucket Fill Tool. First, select a region of an image using one of the Selection Tools (or use ctrl-A to select the entire active layer). Next, double click the Bucket Fill Tool's button to bring up the Tool Options dialog. If you want a solid color to fill the selected region, click on the Color Fill toggle button. Select a color for the foreground by double clicking on the foreground box at the bottom of the Toolbox. The Color Selection dialog will open. Set the color to Red, for example, and then click on OK in the Color Selection dialog. Now, you're ready to fill in the selected region. Simply click on the selected region, and the GIMP fills it with a solid red pattern. You can also fill regions without selecting them using the Fill Threshold slider in the Tool Options dialog for the Bucket Fill Tool. The transparency amount can also be set prior to doing the fill.

Instead of a solid color fill, you can also fill a region with a given pattern. There are a host of default patterns available with the GIMP. To choose a pattern you first click on the Pattern Fill toggle in the Tool Options dialog for the Bucket Fill Tool. Then place the mouse over the Image Window which will be filled and type ctrl-shift-P to open the Patterns dialog. Click on one of the patterns to select it. Then click on the selected region to have the GIMP fill it with the selected pattern. If you create an interesting pattern you wish to use for Pattern Fills, you can save it as a PAT file from the Save Image dialog.

Figure 5. Gradient Editor

The last tool in the fifth row of the Toolbox is the Blend Tool. This tool is used for filling a region in a direction the user specifies with a blended color pattern. The colors used can be blended from foreground to background, foreground to transparent or from a custom gradient provided by the Gradient Editor. The Gradient Editor can be opened from the Image Windows pop down menus as “Dialogs->Gradient Editor”. There are a number of default gradients that come with the distribution as well as a number that have been created or collected by the Gradient Editors author, Federico Mena Quintero, known affectionately to the GIMP developers as Quartic. The resources section of this article lists Quartic's web pages which are considered the definitive resource for finding anything related to the GIMP, including more custom gradients.

A full description of gradients would take many pages, but to get an idea of what can be done with them, consider the cover art for the November 1997 Linux Journal shown at the beginning of this article. The gold background is one gradient, the colors of the stick man are another. Gradients are very useful for creating all sorts of special effects.

Figure 6. Pencil, Paintbrush and Other Tools

The next four buttons are the closest thing to drawing tools the GIMP provides. They are, in order: the Pencil Tool, the Paintbrush Tool, the Eraser Tool and the Airbrush Tool. Each of these requires that a brush type be set. (There is a default setting, but you'll find you'll wish to change this fairly often.) The Brush Selection dialog allows selection of the brush type. Once selected the brush type is applicable to each of the drawing tools. The Pencil Tool draws solid lines that follow the shape of the brush using hard edges. Using a brush like the Duck or Guitar results in an effect similar to using a stencil. The Paintbrush works similarly, although the edges of the stencil are much softer, having been antialiased.

Figure 7. Brushes

The Eraser Tool works just the opposite of the Pencil Tool in that the shape of the brush is used to remove the underlying pixels. Note that this does not mean the new color for the pixels is the background color; instead, the pixels become transparent. Finally, the Airbrush Tool works similarly to the Paintbrush but acts as if the pattern is being blown onto the canvas at a given rate and pressure.

All of the drawing tools use the current foreground color, to do the drawing. If the brush type is not a solid pattern, the darker areas of the brush come out in the foreground color, and the lighter areas of the brush come out transparent (with the current pixels showing through the area the brush doesn't cover). This behavior can be modified using the Mode and Opacity settings on the Brush Selection dialog. The dialog also allows you to specify how fast the brush is applied using the Spacing setting. Lower spacing values cause the brush to be repeated quickly, overlapping the individual applications of the brush shape. Higher settings cause the brush to be applied less often as the mouse is moved around the Image Window.

Aside from the Airbrush tool, the bottom row of the Toolbox also contains the Clone Tool. A rubber stamp icon represents this tool in the Toolbox. This handy tool allows you to use one part of an image to paint or “smudge” over another part of an image. This is useful, for example, for removing the edges between pasted objects or for clearing the edges in a tileable image. Tileable images are ones which, when repeated side by side and top to bottom, have no seams between the images, thus creating the illusion of a solid image. Tileable images are often used as background images for web pages.

To use the Clone Tool, click on the middle mouse button on the bottom row of the Toolbox. Now, place the mouse over the Image Window on the spot you wish to use as the beginning source location. Hold down the control key and press the left mouse button over this spot. A crosshair is displayed beneath the mouse pointer to signify the source has been selected. Now move the mouse to where you wish to begin cloning. The distance and angle between the source and destination points will remain constant as you hold down the left mouse button and drag it around the image. The area used as the source will be the same size and shape as the current brush type, so be sure to set it before beginning the cloning operation. When removing edges in an image, use a brush type that has soft edges; that is, edges that fade from black to white. The Nove brush is good for this type of work. Note that the clone tool can also use a pattern type, just like the Bucket Fill Tool. The use of the pattern or the image as the source can be selected from the Clone Tool's Tool Options dialog.

The last tool in the Toolbox is the Convolver Tool. This tool can be used to sharpen or blur areas of an image; the choice is made from the Convolver Tool's Tool Options dialog. Just select the tool from the Toolbox and then start dragging the mouse around the area of the image you wish to sharpen or blur. The operation is not very obvious using the default settings, which have a Pressure setting of 50 in the Tool Options Window. Play with it a bit to get the hang of how much dragging is required for the desired effect. Increasing the Pressure setting will cause the blurring to be more obvious with less work on your part. The Convolver, along with the Clone Tool, can be used to clean up sludges or to remove unwanted lines and streaks from images.

At the bottom of the Toolbox window, you'll find the Foreground/Background color selection box. This box contains two large boxes, a two-ended arrow and two smaller boxes. The large boxes are the foreground color and background color (top left to bottom right, respectively). Clicking on either will open the Color Selection dialog allowing you to set the current color. The two-ended arrow allows you to swap the foreground and background colors. The smaller boxes, below the foreground color box, reset the colors to their default values.

Most operations use the foreground color for fill, paint and drawing operations unless a pattern has been set. The color should be set prior to clicking on the tool of interest or the results may be unexpected. New layers can be created using the background color as well, so be sure you've chosen the color you want prior to creating the new layer.

______________________

White Paper
Linux Management with Red Hat Satellite: Measuring Business Impact and ROI

Linux has become a key foundation for supporting today's rapidly growing IT environments. Linux is being used to deploy business applications and databases, trading on its reputation as a low-cost operating environment. For many IT organizations, Linux is a mainstay for deploying Web servers and has evolved from handling basic file, print, and utility workloads to running mission-critical applications and databases, physically, virtually, and in the cloud. As Linux grows in importance in terms of value to the business, managing Linux environments to high standards of service quality — availability, security, and performance — becomes an essential requirement for business success.

Learn More

Sponsored by Red Hat

White Paper
Private PaaS for the Agile Enterprise

If you already use virtualized infrastructure, you are well on your way to leveraging the power of the cloud. Virtualization offers the promise of limitless resources, but how do you manage that scalability when your DevOps team doesn’t scale? In today’s hypercompetitive markets, fast results can make a difference between leading the pack vs. obsolescence. Organizations need more benefits from cloud computing than just raw resources. They need agility, flexibility, convenience, ROI, and control.

Stackato private Platform-as-a-Service technology from ActiveState extends your private cloud infrastructure by creating a private PaaS to provide on-demand availability, flexibility, control, and ultimately, faster time-to-market for your enterprise.

Learn More

Sponsored by ActiveState