Getting Started with The GIMP: an informal tutorial

CSLUG and Rock Eagle Presentations, October 2002

Giles Orr


Table of Contents
1. Getting Started
Introduction
Where to Get the GIMP
Installation
2. Adding Text to an Existing Image
Loading an Image in the GIMP
Resizing the Image
Adding Text
Layers
Placing and Modifying the Text
Adding a Background to the Text
Saving the Image
3. Creating a New Image
Starting from Scratch
The Drawing Tools
Colour Selection
Brush Selection
4. Tiles
Other Tutorials
Starting a Tile
5. Miscellaneous GIMP Features
Introduction
Taking a Screenshot
Adjusting Colours
6. Other Resources

Chapter 1. Getting Started

Introduction

The GIMP is the "GNU Image Manipulation Program." The name is more descriptive than most because it tells you that the program is released under the GNU Public License (meaning it's free to use and free to modify), and that it's a program for modifying or creating images.

This tutorial is highly informal, and is a walk-through of some fairly basic things that can be done with the GIMP. I hope this task-oriented tutorial will be more helpful to people than a more formal structurally oriented introduction. The layout of this paper does mean that it's necessary to start at the beginning and follow along, since each section builds on the previous one and assumes you have the knowledge acquired there. Perhaps it will be useful as a reference source after the first run-through - I hope so.

If you find the spelling in this tutorial a little unusual ("colour," "dialogue"), put it down to my being Canadian. I've lived in the U.S. for seven years and at work I spell American, but on my own time I cling to the few things that still make me a Canadian. Of course, this may just be an excuse for not using the spell checker because you won't know the difference between mispelled words and Canadian spellings. :-)

To answer one of the more frequently asked questions I get, the window manager I use is IceWM with the "sortofaqua" theme: it's responsible for the appearance of the borders around the screen shots.

Currently there are pre-compiled binary versions of the GIMP available for at least Linux on the x86 platform and Windows. A Mac port is in progress, but apparently not too solid. If you're downloading it for Windows, look for v1.2.3 - the previous port to Windows was unstable.

The program the GIMP is most commonly compared to is Adobe's Photoshop. I've never used Photoshop, but conversations with a good friend who has used it for many years have revealed that the GIMP has most of Photoshop's features, and it has a much more powerful scripting interface (using Lisp or Perl). Font/text support isn't as good, but I've been fairly happy with what's available - if scalable fonts are available. True Type fonts are definitely a plus, although they remain something of a challenge to support under Linux.


Where to Get the GIMP

The GIMP homepage is at http://www.gimp.org/ where you should follow the "Download" link. This will get you the latest version (v1.2.3 at this writing) in tar.bz2 format, and you'll have to compile it yourself. I generally use precompiled binaries - these are available for just about every Linux distribution, and usually installed by default.

The Windows version is available at http://www.gimp.org/win32/ and http://www.wingimp.org/. The latter is a link from gimp.org, while the former is a more complete and nicer looking project page. I believe they're both maintained by the same person. They're currently offering version 1.2.4 prerelease.


Chapter 2. Adding Text to an Existing Image

Loading an Image in the GIMP

Start the GIMP. If this is your first time running the GIMP, you'll be walked through setting up the configuration files - accepting the defaults works well. You'll also be asked to calibrate the screen. You can either accept the defaults again, or you can get out a ruler and measure a ruler the GIMP puts up on screen. I recommend this, but unless you have an unusual screen or need very accurate on-screen representation, it probably isn't necessary.

The GIMP usually starts several windows when it runs. Look for the one pictured below, which is the main panel.

Press "File" and select "Open." You'll be shown a GTK file selection panel - some Windows users find this a little different, but it's use should be fairly straight-forward to any Linux user. Windows users should note that directories (including other drives) are in the left panel and files are in the right panel.

Open an existing image file you want to work with: the GIMP understands almost all image file formats in existence today (although it should be noted that because of patent encumberments some versions of the GIMP will no longer save in GIF format). We'll be making several modifications to this image - please save it under a different filename, don't overwrite your original! The modifications I'm going to work through may not improve your image, but you can try these changes to see how they work.

I've chosen an image of the Joshua Tree Monument I took about ten years ago:

When you're working on an image, most of the menus you'll use are accessed by right-clicking on the image, NOT on the main panel. Use the panel to select tools, but get your menues by right-clicking on the image.


Adding Text

We'll now add text to this image. To select the text tool, go back to the main Gimp panel, and click on the "T". This selects the tool. In this case, we'd like to change the tool default values: that's done by double-clicking on the tool selector. Double click on the "T" and you should see a window like this:

The GIMP defaults to the older text tool - it works, but I'd highly recommend you click the "Use Dynamic Text" checkbox. The default text tool only allows a single line of text, whereas Dynamic Text allows multiple lines. There are numerous other improvements as well.

It's not necessary to close the "Tool Options" window: you can leave it open and it will reflect the options of whatever tool you're using, or you can close it. The choice is yours.

If you move the pointer over the image, you'll see that you get the "I-beam" indicator, showing you that if you click on the image you'll be inserting text. Each tool you can use in the GIMP has its own cursor indicator like this, and you'd be wise (wiser than me) to pay attention to what the cursor is telling you. If you click on the image with the wrong tool, you can do some bad things to your image.

Which brings us to another digression about a very useful key combination. "Ctrl-Z" is possibly the most important thing you can learn about the GIMP. It means "Undo the last change." Please note that you have to have an image window selected for it to work. You can undo multiple changes - usually five, although you can reset the value in the defaults.

Click on the image to bring up the text tool. If you're using Dynamic Text, it doesn't really matter where you click, as the Text Tool has a positioning control built in. I don't find this useful when adding text to pictures, it's easier to just let it drop the text where it wants and then I can move the text to where I want it to be. See the images that follow to see how I set up the text, and where it appears on the image.

Note the black and yellow dashed line around the text. This indicates that the text has been created in a new layer, and that means it's time for another digression.


Layers

The commonest comparison for Layers is to a stack of transparencies. The background (in this case, the initial image we chose to edit) cannot have an alpha channel (be transparent), but you can add layers on top of it that are. In the case of the text layer you just created, it's transparent everywhere there isn't black text. You should also notice that the text layer is much smaller than the image: layers don't have to be the same size. If we added another opaque layer on top of our image, then you'd only see the opaque layer on top. Layers can also be partially transparent - we'll get to that.

To see what layers we have, let's open the "Layers, Channels & Paths" dialogue box - depending on how the GIMP is set up, it may be open already on your machine. Even if it is already open, it won't do any harm to use the menu item to activate it. Right-click on the image and select "Layers -> Layers, Channels & Paths ..." You should see something similar to the following:

Note that we have two layers, one titled "Background" (which is the original image) and one titled "GDynText Layer" which was added by the text tool. There are a lot of things you can do with layers. The most basic is controlling the visibility of the layer: click on the eye icon beside the layer to toggle its visibility on and off. You'll find that if you turn off the Background, you'll see a checked pattern of light and dark gray squares. This indicates that there's nothing visible in any area where you see that pattern. Leave both layers visible when you're done.

If you click just to the right of the eye icon, you'll see the link icon, a set of crossed arrows (like the move tool we'll be discussing shortly). Clicking on them toggles them on and off. Leave these turned off for now.

Notice that if you click on a layer (towards the right side, away from the eye and link icons) the layer becomes highlighted. When the layer is highlighted, any tools you use will be applied to that layer - even if the layer isn't currently visible because it's behind another layer or the visibility is toggled off. I've been caught off guard by that, it's something to watch out for. Always be aware of which layer is selected so you know what you're working on.

You can create new layers (the single piece of paper icon in the "Layers, Channels & Paths" dialogue), or duplicate existing layers (the double pieces of paper in the dialogue). New layers are usually used to overlay another visual piece on an existing image, while duplicate layers allow you to change existing data while simultaneously keeping it in unmodified form.

Try right-clicking on a layer and notice that there's a menu associated with the layer. This is material you'll have to explore on your own.


Placing and Modifying the Text

With both the layers visible and the text layer selected, choose the move tool (the crossed arrows) in the main panel. Now move the cursor over the text we added to the image, noticing that the cursor changes between a hand when you're over the background and a move icon when you're over the text. In fact, if you click and drag on the background rather than the text, you'll move the background. Remember that you can undo mistakes with Ctrl-Z. Move the text to where you think it looks best.

With the text layer still selected, right-click on the image and choose "Layers -> Layer to Imagesize." This will increase the size of the text layer to match that of the image. The utility of this change isn't particularly obvious at this point, but it's helpful in some of the changes we'll be making later, it doesn't cause any problems, and I find the layer border (the yellow and black checked line mentioned earlier) distracting. This is one of several ways to resize a layer.

Now duplicate the layer. to do this, make sure the text layer is selected in the "Layers, Channels & Paths" window, then press the doubled piece of paper.

So you have two copies of the text. It doesn't look any different ... Since they're in exactly the same place, they overlay each other and the original copy can't be seen because of the new copy.

Let's keep better track of our layers - we can name them, and this will become very useful when you start working with multiple layers. Go to the "Layers, Channels & Paths" dialogue box, and double-click on the new copy. Replace "GDynText Layer copy" with something like "Text". I use this rather than "Joshua Tree Monument" because it's much shorter and I only have one piece of text to work with so it remains unambiguous. Do the same thing for "GDynText Layer," calling it "Text Shadow."

We're now going to blur the "Text Shadow" layer, so make sure it's selected in the "Layers, Channels & Paths" dialogue box. I would also recommend that you make the top layer ("Text") invisible by clicking on the eye icon, but this isn't strictly necessary. Also in the Layers dialogue, make sure that "Keep Trans." is NOT set. It's usually set, and we want to turn it off. Blurring (which is what we're headed for here) won't work with "Keep Trans." Now right-click on the image, select "Filters -> Blur -> Gaussian Blur (RLE)". There's not a lot of practical difference between RLE and IIR (I don't claim to understand it either), but the authorities tell me RLE is slightly better to use on computer generated images. You'll now be presented with a dialogue box like the following:

Set the Blur Radius to 10 and press OK. This should result in the text you've been looking at being replaced by a very blurry version of itself. This is going to be our drop shadow. But being a drop shadow, you don't want it directly behind the original, but offset down and to one side. There are two ways to do this: either click and drag it, or use the "Offset" menu item. The problem with click and drag in this case is that you can't see the Text layer - but if you turn its visibility back on, then it's hard to click on the shadow to drag it because it's hiding behind the top layer ... So I use "Image -> Transforms -> Offset ..." (I'll assume from now on that you know to right-click on the image to get at the menus). This brings up another dialogue box:

To move the shadow down and right enter "7" and "7" (an appropriate offset depends on the font size - this works well with the 50 pixel font used here). After saying OK to this, turn the visibility of the top layer of text back on. I felt that the appearance of the shadow was too heavy, so I went back to the "Layers, Channels & Paths" window where to move the Opacity slider for the "Text Shadow" layer down to 50. This leaves the shadow still visible, but not obvious. When you have a very heavy drop shadow, it's more obvious how the 3-D effect is created and it can lose some of its magic because of that. Subtlety is a good thing ...


Adding a Background to the Text

We'll now add a background to the text to emphasize it a bit more. Add a new layer (if in doubt, add a new layer - you can merge layers easily, but separating them is difficult to impossible) in the Layers dialogue by clicking on the single sheet of paper. You'll get a new dialogue box for "New Layer Options." The defaults should be good, but make sure that "Layer Fill Type" is set to "Transparent." With your new layer selected, use the arrow keys in the Layers dialogue to move the new layer down the layer stack until it's under the two text layers.

In the main GIMP panel, select the "Select Rectangular regions" tool (the dashed square). Put the pointer over the image and select a box slightly larger and centered around the text:

To blur the edges of the selection, use the "Select -> Feather ..." dialogue, using a 10 pixel feather. Select the bucket fill tool from the main panel (it's easy to spot - it's a bucket). By default, bucket fill uses the foreground colour - that's the colour in the lower left corner of the main panel. The upper, "dominant" colour (usually black by default) is the "foreground" colour. Reverse the foreground and background colours by pressing the double-ended arrow by the colours:

Click inside the selected area in the image. This should bucket fill the selected area in your new layer with white. Again, subtlety is good: reduce the visibility of the layer to about 30 (what looks good will depend on the colour of the image you're working above). To get a good look at your new creation, use "Select -> None" to get rid of the marching ants.


Saving the Image

The GIMP can open almost any kind of image format available today, and it can also save in almost any format. But unless you're absolutely sure you'll never want to edit the picture again, save in the GIMP's native format, XCF. XCF files save all the layers, channels, and paths you've created. It even stores undo information, and it's not a lossy format. As a result, XCF files tend to be very large.

Use the "File -> Save As ..." dialogue to save the image. The default setting for "Save Options" is "Determine File Type: By Extension" which means that you add the extension of your choice and it uses that as the file type. So enter "filename.xcf" in the text box and say "OK."

XCF files can't be viewed by web browsers, so do "File -> Save As ..." again, this time using "filename.jpg" as the file name. You'll be confronted with the following dialogue:

As this states, the JPEG file format can't deal with transparency. It also can't deal with layers, so the GIMP pushes all the layers into one before saving as a JPEG. If your background has transparent areas (not the case here) the GIMP will fill it in with some colour - your mileage may vary. Since we have transparency but it's not in the Background, the result will be a JPEG that looks almost exactly like what we see in the GIMP. Click on "Export." But you're not done yet: most file formats have their own set of options, and JPEG is no exception:

Here you can adjust the "Quality" or compression - and several other things. The higher the compression, the smaller the image - and the poorer the final image quality. Note that it says near the top of this window "Preview (in image window)". You can take a look at the Preview to see what damage JPEG compression is doing to your work. "75" is usually pretty good for web display, but this depends on a lot of things: if you have fine text in the image, you'll find that you have to use extremely high quality to prevent compression artifacts from being visible (in English: it doesn't look good, and your viewers will notice this). This is because JPEG was designed for photographic images (on which it works superbly) and doesn't work as well with clear lines. To give you some idea of the trade-off, take a look at the following three images:

Notice in the final image that the sky is becoming visibly chunky: this is how JPEG saves space, by reducing the number of colours and painting large areas a single colour. If you look at the three images closely, you should also notice that artifacts (visual defects) appear first around the text: as I said earlier, JPEG doesn't handle text well. In fact, I originally intended to use PNG images (a lossless image format) for all of the images in this paper, but the size was prohibitive and I decided to accept the reduction in quality so that you would be able to download the paper more quickly.


Chapter 3. Creating a New Image


Brush Selection

Select the paint brush tool now, and select another colour (I'll try blue). But this time I'm going to select a new brush. Click on the item I labelled "Active brush" to get the Brush Selection dialogue. So far we've been using the default brush, which is a hard edged circle 19 pixels in diameter. As you'll see, you have a lot of choices in brushes. Notice that there's even a "New" button - you can create your own brushes if you want to.

I chose the "Calligraphic Brush#2," an angled line that occupies a 20x20 square. Draw another horizontal line beneath the other two.

Let's try one more pedestrian lesson before we move on to the really interesting stuff: select the air brush tool, and pick the sharp edged 19 pixel brush again. Pick another colour (I'm using yellow). Draw another horizontal line below the previous three. Draw VERY slowly in places, and notice that the longer you stay in one place, the more paint it leaves behind. You should have something like the following:

Let's try out the eraser. Select the eraser tool from the main panel, and run in vertically down across the other lines you drew. Notice that it erases in the shape of the brush that you have selected. An important note is that on any other layer than the background (we never added any layers to this image, so we're still working on the background) you would remove ALL colour - the area you erased would become transparent. On the background, it erases to the original background colour.

Select the paint brush tool. Double-click on the paint brush to bring up the "Tool Options" dialogue window. Notice that we have a huge selection of options. Set the opacity to approximately 50.0 and draw another vertical line cutting across your horizontal lines (I still have yellow selected, if you're following that closely). Notice that the resulting line isn't entirely opaque, as you might expect. Draw another line half overlapping the one you just drew, and you'll see that the effect is cumulative - where the lines overlap, the yellow is stronger.

Adjust the paintbrush tool options again - reset the opacity to 100% and set the Mode to "Difference." Draw another vertical line crossing your horizontal lines. The first surprise is the colour: you'll find that at first it seems you're drawing in blue, until you hit another line. Since the mode is set to difference, the colour you use is inverted when you draw on a white background, and you get the difference of colours every time you cross another line. Since blue and yellow are colour opposites, when your yellow line (which looks blue!) crosses the blue line, you get white - because blue and yellow are completely different. At this point, we've moved into a realm of drawing that has no parallel in the physical world of paper and paint - up until now, you could almost imagine yourself doing all of this on paper ...

There are a lot of different modes, and you know how to change them now. Whether they're of practical use to you will depend on how you choose to use the GIMP. I recommend that you experiment at least a little with the modes to see what they do - but that exploration is up to you.

To close this section, let's take a quick look at a couple more painting tricks. First, set the paint tool options mode back to "Normal." Then click on the brush in the main panel and change to the "Confetti" brush - it looks about the way the name implies, a bunch of confetti. Change the colour to red and draw another vertical line with your new brush. You'll notice as you draw that this brush only marks your canvas very infrequently. Part of brush design is deciding how often the brush will print itself on the canvas - most brushes do it so frequently that the result looks like a solid stroke, as you would expect from a real life brush. As unusual as it is, behaviour like the Confetti brush can produce very interesting results.

Switch back to a round brush. Go into the Paintbrush tool options again, and switch on both the "Fade Out" checkbox and the "Gradient" option. Try painting anywhere you like. The brush changes colour as you paint. The colours it uses are the ones from the "Active Gradient" (marked on the main panel at the beginning of this chapter). You can change the gradient by clicking on it in the main panel. You'll also see that the brush fades out to nothing as you paint and you have to click again to get it to start painting again. The distance over which it fades is adjustable (the numerical selection box beside the checkbox in the tool options window), as is the distance over which the colour cycles. Try adjusting these to see what they do.


Chapter 4. Tiles

Other Tutorials

At this point I'm going to point you to some other tutorials for the GIMP rather than duplicating good work that someone else has already done: http://www.gimp.org/tutorials.html. Follow through "The Basics" and "Easy Patterns" at least. You'll find some duplication of what I've discussed, and some of the new material that you cover I'll cover again later, but I hope that most of it will be complimentary.


Starting a Tile

Since I'm most familiar with making tiles, that's the subject we're going to discuss in this chapter. When I say "tile," I mean an image that matches up with itself along the edges so you can use it as a seamless repeating background. I like to make tiles for use as computer screen backgrounds - that means rather less visual subtlety than you might use for a web page background, but most of the same principles apply.

I generally use the GIMP's extensive selection of filters to generate images. That's what I'll be covering in this chapter, as using drawing tools was covered in the GIMP tutorial mentioned above, "Easy Patterns."

Start a new image. I'll be working at 400x400 pixels in size, but the choice is yours. As always, remember that the bigger the image is, the more space it takes up.

Now might be a good time to mention the wonders of tear-off menus. There are certain menus that I end up using a great deal, and it becomes tedious to keep right-clicking on the image and then navigating the menu system to the item I want only to have to repeat the process almost immediately. The authors of the GIMP have come up with a fairly nice solution to this: right-click on the image, navigate to the menu you want to use (I would suggest "Filters") and notice at the very top of the menu there's a dashed line. If you put your pointer over that, you'll notice that it becomes highlighted like any other menu item. Click on it, and the menu becomes its own window that you can position anywhere you want.

I recommend creating most new material for tiles on their own layers - particularly when you're working with the "Render" menu item, as it overwrites the current layer. So as a first step, create a new layer. Now click on "Render" in the Filters menu, and select "Clouds -> Solid Noise ..." In the dialogue box that appears, click the "Tileable" checkbox. This is obviously a really nice feature to have if you're working on tiles, and it's available in a few of the dialogue boxes we'll be working with. I'm going to click the "Turbulent" checkbox as well because I like the effect. If you're curious, you can create a second layer with "Turbulent" toggled the other way so you can see what the two do differently. The "Random Seed" setting is interesting too: by default it's set to "1", and if you come back to this dialogue later, you'll get the same pattern again with the number set on the same time. If you want to get a different pattern each time, click the "Time" button and you'll get a (mostly) random number chosen every time you generate a Noise picture.

To verify that the material you've created is tileable (a good practice - I've spent a lot of work on some images only to find I did something non-tileable several steps back and I had to discard the image) right-click on the image, select the "Image -> Transforms -> Offset ..." item. In the dialogue box that appears, select the "Offset by (x/2), (y/2)" button. You'll notice that it puts 200 in the X box and 200 in the Y box (if you're working with a 400 by 400 image). Say "OK." The image is offset by 50% in both directions, and you should still see a seamless image. If you don't, go back and check that you had the "Tileable" button switched on. Remember to perform this check occasionally. You can now click CTRL-Z to reset the image to its original position. In fact, I'd recommend this - not because it's necessary now, but if you make tiles much you'll find yourself working with layers that match up in a particular position, and offsetting one will ruin the image. So hitting CTRL-Z to undo the change is good practice.

Make a new layer. In the new layer, use "Filters -> Render -> Clouds -> Plasma ..." to generate some colours to add to this black and white image. Now hit CTRL-SHIFT-O (the keyboard equivalent of the Offset command we just used) and offset by x/2, y/2. You'll immediately see that Plasma doesn't render a tileable image. Use CTRL-Z to set the image back where it was, and now select "Filters -> Map -> Make Seamless." I'm not too crazy about this filter, but it does work. You may notice bands of colour half way along each edge of the image, and that's the price you pay for "Make Seamless." Finally, go to your "Layers, Channels & Paths" dialogue box and set the mode of the plasma layer to "Overlay." You now have a tileable image that you can save. Try setting the plasma layer's mode to other modes, and see how they look too.

The tile we've generated isn't that exciting, but in combination with the previously mentioned GIMP tutorials you should be on your way to creating something much better.

If you're interested in making tiles, I would highly recommend that you download the Plasma2 plugin from the GIMP plugin registry at http://registry.gimp.org/. If you have the Windows version of the GIMP, it's already included, but most Linux users will have to download it for themselves.


Chapter 5. Miscellaneous GIMP Features


Adjusting Colours

If you have a bad image (poor quality scan, bad exposure ...) it can sometimes be rescued by adjusting the colours. The GIMP provides a multitude of ways to adjust colours. Right-click on the image and navigate the menu to "Image -> Colors" where you'll find another menu populated with several different options. My preference is for the "Curves ..." dialogue: you can do pretty much anything with it that you can do with any of the other options, and I find I understand it more intuitively. Please note that you may try it out and decide it's totally UNintuitive: you need to see which method works for you.

Let's start with the seamless plasma from the tile chapter (I've set the layer mode back to "Normal"):

Open the "Curves ..." dialogue. The default for "Curves" is to modify the brightness of the entire image - but you can choose to work just on a specific colour channel. Here's the results of the most basic "drags" you can do on the curve:

After doing a lot of work on damaged images, I've come to the conclusion that fixing an image is a magician's art, there's very little science involved. The science is in the numbers, in what the curve does to the image. The magic is making it amount to something that looks good, and that isn't easy. I could have shown you this with a "real" image, but the effects are just as obvious on the plasma image and the only way to learn to use colour corrections is to practice yourself.

As always, subtlety is a good thing: if increasing the contrast makes an image look better, then increase it until you start to think it's too much. Then pull back well beyond what you thought was the acceptable limit. As always, your mileage may vary, but this has almost always worked for me - and saved me from posting some blaringly contrasty images. You look at that neon-bright version of an image too long and it starts to look okay ...


Chapter 6. Other Resources

The tutorials at the GIMP site are very good: http://www.gimp.org/tutorials.html

There are at least two books available online: the GIMP User's Manual, aka GIMP: The Official Handbook available at http://manual.gimp.org/, and Grokking the GIMP available at http://gimp-savvy.com/BOOK/index.html. Of the two, I definitely favour the latter: it's fairly straight-forward, while I find the former difficult to use online and sometimes overly complex. Both are also available in paper versions: I think I'd like the User Manual better in paper, but I don't own it and can't say for sure.

Two other good books on the subject are Alex Harford's GIMP: Essential Reference, published in 2000 by New Riders, and Michael Hammel's Essential GIMP for Web Professionals published in 2001 by Prentice Hall PTR. Of all of these books, I find myself referring to GIMP: Essential Reference the most. I'm not sure it's the best to learn from (Essential GIMP for Web Professionals was pretty good for that), but once you know the GIMP it's very well organized as a reference (I don't take it for granted these days that something that says it's a "Reference" will actually be good for that ...)

The GIMP plugin registry at http://registry.gimp.org/.