Troubleshooters.Com and T.C Linux Library Present

Gimp for the Artistically Challenged

Copyright (C) 2001, 2009 by Steve Litt, All rights reserved. Material provided as-is, use at your own risk. 


By Steve Litt
   Contents on This Page
         Links on Other Pages

This 2001 Information is Still Good

I'm writing this paragraph in April 2009, when Gimp 2.4.5 is already starting to be a little old. The rest of this web page was written in 2001, when Gimp 1.x ruled the world. So the mouse clicks and other procedures detailed on this web page will be a little different than on modern Gimp versions. For instance, to get a layer list on Gimp 1.x, you rightclicked and picked Layers->Layers, channels and paths. With Gimp 2.x you right click and choose Dialogs->Layers.

Nevertheless, this web page retains most of its usefulness, because the underlying graphic procedures haven't changed. For instance, whether you're using 1.6 and must rightclick->Layers->Layers, channels and paths, or 2.x and must rightclick->Dialogs->Layers, either way, the layer list is about the same between the versions, and you can do the same things from the layer list. So although you can't use this web page to blindly follow instructions, it's still very good for figuring out how to do what you need to do.

Future additions to "Gimp for the Artistically Challenged" will be added as separate web pages. So be assured, this information may be a little old, but it's still very useful.

Starting and Exiting Gimp

You can start Gimp from your system menu, or with two commands, the first of which is:
$ gimp &
The preceding command starts Gimp with no image. The ampersand on the end runs Gimp apart from the terminal that started it. If you leave off the ampersand, the terminal is busy as long as Gimp is running, but otherwise it's perfectly OK. The preceding command brings up two windows that look something like this:

Note that some Gimp configurations bring up more windows. The only important window above is the toolbox window -- the one with pens, pencils, brushes, eyedroppers and the like. The other window is a tips window which  you'll close, although it's nice sometimes to read a few of the tips before you close it.

Once you close it you'll see the toolbox window, which looks like this:

You can also run a command to open a file with Gimp. The following example opens a file called wildman.jpg with Gimp:

$ gimp wildman.jpg &
That command brings up the same windows as the command without the argument, and in addition it brings up a window with the image (in this example wildman.jpg). The additional window looks something like this:

To exit Gimp, go to the toolbox window and choose File/Quit. This will quit Gimp and close all open files. If any of the files is unsaved, you'll be queried whether you really want to close unsaved files.

Loading, Saving, Closing and Reverting Images

We already discussed how to run Gimp with an image already loaded, but to repeat, it's:
$ gimp wildman.jpg &
The other way is to choose File/open from the menu on the toolbox window, and navigate to the picture you want.

If you're in Gimp and want to create a new file, then from the toolbox window's menu choose File/New, and fill out the information on the dialog box presented to you.

To save a file in Gimp, right click anywhere in the image you're editing, and choose File then Save or Save As. The Ctrl+S keystroke combination is the same as File/Save.

To close a file, right click the window containing it, and choose File then Close. If the drawing has been edited since the last save, you will be asked whether you really want to do this.

Sometimes you make a mistake and want to revert a file to the last saved version. Right click the drawing, then choose File and Revert. Note your intentions are not verified, so what ever you do, never click revert by mistake.

Zooming In and Out

Pixel-exact editing requires zooming to very large magnifications. Repeatedly pressing the equal sign key (=) repeatedly zooms in (larger magnification). Repeatedly pressing the minus sign key (-) repeatedly zooms out (less magnification). You can feel free to use large magnifications when drawing long lines, cropping, selecting (marquees), because as you drag the mouse pointer, then drawing scrolls. Practice zooming in and out until it's second nature, because when doing pixel editing, you'll often zoom out to get the big picture, then zoom in for accurate selections, and then out again to verify you did it correctly.

Cropping

I often like to do a rough crop, followed by a fine crop. The rough crop can be done quickly at no magnification, and then the fine crop can be done exactly at high magnification. That way when it comes time to do your fine crop, you aren't distracted by junk outside the crop area.

Rough crop

At no magification (1 to 1) Move the mouse pointer to a corner significantly outside the final fine crop area, and press shift+C. Then drag to a point significantly outside the opposite corner of final fine crop. Then press Enter or click the OK button on the "Crop & Resize Information" dialog box. At this point you'll have the intended final crop area, with a small border around it. You may wish to save your drawing (probably to another name, if you have intentions of using the original uncropped image).

Fine Crop

This is where you crop to pixel exactitude. Start by pressing the equal sign several times (8 is a good number) to gain magnification. Now use the scroll bars to get to the one corner of the final crop area. Hover the mouse pointer near the corner to be cropped, press the Ctrl+C keystroke combination, then drag slightly to the interior of the crop area and release. You now have a rectangular selection area with four movable corner points, as shown in the following partial screenshot:

You'll notice that the corner you started with and its opposite corner have no lines outside their corners, but the other two corners have lines extending outside the corners. The points at the corners with extending lines can be used to move the entire crop area, while the corners without extending lines can be used to change just that corner, therefore changing the position of just the lines coming to that corner.

Before continuing, click the "Crop & Resize Information" dialog box's title bar and move it out of the way. You'll use it later. Now click the title bar of the drawing, and drag the crop corner you started with to the exact place you want that corner. Because you are at high magnification, you will see the corner jump from pixel to pixel. In this way you can get a pixel-exact position.

Next, drag the corner opposite the starting corner toward the opposite corner of the final cropping area. The drawing will scroll in such a way that you can no longer see the starting corner. Don't worry, the starting corner will remain where you put it. When you get to the the opposite corner of the final crop area, once again adjust the corner you're dragging in  a pixel-exact way. Once you have it pixel exact, switch focus to the "Crop & Resize Information" dialog box, and click its Crop button. Your drawing is now properly cropped to pixel exactness.

Cropping around two windows in a screenshot

Sometimes you need to crop two windows in a screenshot image. In such cases, you have no landmarks for the final corner, because of the differing sizes and positions of the two windows. In such a case, start your crop at a corner marked by an actual window, then drag

The preceding screenshot is just such an example. I started with the lower right corner, and need to drag to the upper left corner. But the upper left corner is above the image of the toolbox window. So I dragged the upper left corner to the edge of the toolbox window, and then note the little triangle near the 0 on the horizontal ruler at the top (it would actually be at about 18 on the ruler, but the nearest numeric landmark is 0). I can now continue to drag up, and as long as I keep the triangle in the same place, the left side will be perfect when I finally get the top side to the proper place. Note this works best at high magnifications, because otherwise it's hard to know if the triangle is positioned right.

Color Reduction

There's exactly one reason for color reduction -- reducing bandwidth. Because of the compressive nature of .jpg files, color reduction does little to reduce the size of .jpg files. Color reduction is most effective reducing the size of .png and .gif files. Note that because .gif files are covered by a patent, you should not create new .gif files, and should take steps to convert your old .gif to .png.

But anyway, here's a script, called 256, which reduces the depth of a .png to 256 colors.
 
#!/bin/sh
convert -depth 24  $1 $1
convert -depth 16  $1 $1
convert -depth  8  $1 $1

and here's another script, called 16, which reduces the depth of a .png to 16 colors:
 
#!/bin/sh
convert -depth 24  $1 $1
convert -depth 16  $1 $1
convert -depth  8  $1 $1
convert -colors  16   $1 $1

The reason we convert down gradually is to get the best color simulation. Also, always crop before you color reduce, so that extraneous colors that got cropped away don't influence the color approximations.

Making Pixel at a Time Changes With a One Pixel Brush

Note: If you're having trouble creating exactly sized selections required to create these shapes, take heart. The next article explains how to resize selections. But let's do the simple stuff first...

If you're anything like me, you need a pixel editor to edit a pixel at a time. Gimp's defaults involve pencils and brushes that draw broad strokes. To do pixel by pixel editing, you need to choose a single pixel brush. Start with a drawing you have open, and then:

  1. On the toolbox window, click the pencil ().
  2. Right click the drawing, choose Dialogs and then Brushes, and you'll be brought to the following brush choice dialog:

  3. Click the single point brush, as shown above, and you'll see the display change to "Circle (01) (1 x 1) as shown following:

  4. Now anything you draw with the pencil will be one pixel wide.

Drawing Straight Lines

Straight lines are drawn with the pencil. You should start by picking the proper brush, as described in the preceding section.
  1. Select the pencil tool ().
  2. Select the proper brush as described in Making Pixel at a Time Changes With a One Pixel Brush.
  3. Click and release EXACTLY where you want your line's starting point. A single point will be drawn. You must be exact, because you will have no opportunity to move or change that point. You might want to make that point at a high magnification.
  4. Move the mouse, and then depress the shift key. You'll see a construction line appear between the starting point and the mouse pointer. That line will move as you move the mouse. When you have the mouse pointer exactly where you want the end of the line to be, click once more. The line will be created.
Note that if you continue to depress the shift key, and continue to move the mouse, a new construction line will extend from the end of the previous line to the mouse pointer. In this way you can easily draw complex multiline shapes. You can fill those shapes with the bucket tool ().

Drawing Rectangles and Ellipses

To draw a hollow rectangle:
  1. Create a rectangular selection, whose dimensions are what you want the final rectangle to be, with the "Select rectangular regions" tool ().
  2. Choose the proper brush width, as explained in "Making Pixel at a Time Changes With a One Pixel Brush".
  3. Right click anywhere on the drawing, choose Edit, and then choose Stroke. Notice that a hollow rectangle has been formed, with its lines half inside and half outside the original selection.
To draw a hollow ellipse, follow the instructions for the hollow rectangle, except use the "Select eliptical regions" tool ().

To draw a filled rectangle or ellipse, create the rectangular or elliptical selection, and then use the bucket tool () inside of it.

To create a filled rectangle or ellipse with a border, draw a hollow rectangle or ellipse with the border color, click "Select rectangular regions" tool (), click outside the current selection to "turn off" the current selection, choose the fill color with the color picker and foreground/background color tool (), and then use the bucket tool () to "pour" that color inside the already created hollow rectangle or ellipse.
 
 

NOTE

To save time filling selections, instead of switching to the bucket tool, you can simply right click inside the selection, and choose Edit->Fill with FG color. There's an Edit->Fill with BG color to save you even more time.

Resizing and Moving Selections

Resizing selections is one of Gimp's few weak points. In many draw and paint programs you simply drag the selection. It's not as simple in Gimp. In fact, it's tough enough that you might want to try extra hard to get the selection exactly right the first time.

Moving a selection

To move a selection, without moving the content it encloses, press the Alt key and drag the selection.

Be aware that dragging a selection moves the actual content contained by the selection. That's probably not what you want.

Because moving a selection is much easier than resizing one, and because resizing can be done only one side at a time, it's best to move the selection so one of its corners is in the exact correct place. Then you'll need to resize at the most 2 sides. If you didn't move first, you might need to resize 3 or 4 sides. So always move the selection until one of its corners is in the right place. The easiest way to exactly position a corner is to move it close to the correct location at no magnification, then press the equal sign several times so each pixel of movement is obvious, and position it exactly.

To enlarge a selection

The only way to enlarge a selection is to move one side at a time. The side isn't really moved. Instead, an additional selection is drawn such that the additional selection will be "added" to the edge of the first one. That implys that the second selection must be exactly the same width as the first, and it must be exactly aligned. Exactness implies great (like 8x) magnification. Because Gimp scrolls the screen to accommodate dragging, the magnification is practical.

So here's the procedure for extending a rectangular selection farther down from the bottom:

  1. Magnify the screen 6-8 times with the = key.
  1. On the toolbox, click the rectangular selection tool ().
  2. Locate the lower left corner of the existing selection.
  3. Place the mouse pointer a few pixels straight up from the bottom left corner, meaning the pointer is on the line defining the left side of the existing selection.
  4. Depress the shift key, and note that the mouse pointer now has a plus sign (+).
  5. Drag several pixels down and to the right. Note that the new selection grows as a square, not as a rectangle.
  6. While still holding the mouse button, release the shift key, and note that you can now drag down or right as you please.
  7. Drag down to the the desired bottom of the grown selection.
  8. Note the exact number that the left hand triangular ruler mark rests on. This is how you will make sure that when you drag right you don't drag up or down.
  9. Drag right until the right side of the new selection overlays the right side of the original selection.
  10. Drag up or down until the left hand triangular ruler mark rests on the same number as it did when you dragged down the desired distance.
  11. Release the mouse button, and note that you've grown the rectangle perfectly.
  12. Reduce the magnification with the minus key (-)
A few comments on the preceding procedure. First, you could have used similar procedures to grow it right, left, or up. Second, in any type of dragging, the rulers on the top and left are your friend. The higher the magnification, the more likely those marks will be exact to the pixel.

To shrink a selection

The procedure to shrink is basically the same, except you use the Ctrl key, which gives the mouse pointer a minus sign, and also you start from the point you want to be the bottom:
  1. Magnify the screen 6-8 times with the = key.
  2. On the toolbox, click the rectangular selection tool ().
  3. Locate the lower left corner of the existing selection.
  4. Move up the left edge of the original selection to the point that should be the new bottom, and place the mouse pointer at that point on the left side of the original rectangle.
  5. Depress the Ctrl key, and note that the mouse pointer now has a minus sign (-).
  6. Drag several pixels down and to the right. Note that the new selection grows as a square, not as a rectangle.
  7. While still holding the mouse button, release the shift key, and note that you can now drag down or right as you please.
  8. Drag down to the the desired bottom of the grown selection.
  9. Drag down until the bottom of the new selection overlays the bottom of the old selection.
  10. Drag right until the right side of the new selection overlays the right side of the original selection.
  11. Release the mouse button, and note that you've shrunk the rectangle perfectly.
  12. Reduce the magnification with the minus key (-).

Irregular grows and shrinks

One cool thing about this is you can grow and shrink in irregular patterns, and even on elliptical curves. To explore this, try growing and shrinking but not matching the sides, and notice that you can make "dimples". And if you use the eliptical selection tool (), those dimples can be curved. Experiment.

Using Layers

Gimp is pixel based -- not vector based. Vector based graphics have the advantage of being able to move image parts as objects rather than groups of pixels. That means you can pile objects on top of each other and later separate them again, without damaging the image parts below the object. Just try that in most pixel based graphic programs.

But Gimp has layers, and used right, you can gain that same advantage. For instance, take the cover of my new (as of December 2001) book, "Troubleshooting Techniques of the Successful Technologist". It was designed in Gimp. Here's a smaller version of the book's cover design:


 
 

Here's what my layers look like:

Layers in my book cover
 
 
Layer Contains and portrays
Background Contains the rectangular box whose left side is thicker than the others. Note that this box DOES NOT feature rounded corners
corners Contains shapes which, when properly placed over the box's corners, give the box rounded corners
const lines A layer for drawn construction lines. Note that the eyeball is missing from this layer, as the final product should not show the drawn construction lines. Note also that in most cases construction lines should be dragged from the rulers, not drawn
title Contains the 2 line title plus the author's byline.
utp_ad Contains "Includes full Universal Troubleshooting Process documentation", and the 10 steps of the Universal Troubleshooting Process
divcon Contains the divide and conquer symbol (square iteratively cut further in half, and the legend "A Troubleshooters.Com Publication"

In this way I can move the various elements around without jeopardizing other elements. For instance, I can select the divide and conquer symbol and place it on top of (or beneath if I rearange the order of the layers) the 10 steps. And then later I could move it elsewhere without disturbing the 10 steps.

Using layers, you can simulate the "objects" of vector drawings in all manner except shrinking and growing.

Retroactively Making a Layer Transparent

All you want to do is scan a signature written in black pen, then put a light blue line under the signature. Sounds trivial, but it's not obvious. What won't work is simply drawing a line -- the line will overwrite the signature instead of underwriting it.

Gimp Guru Andrew Wyatt contributed this excellent solution. Do the following:
  1. From Gimp, File->Acquire->Sane to create an image of the signature. Scanned signature
  2. Rightclick, Image->Alpha->Add alpha channel, in order to make this layer transparent.
  3. Rightclick, Select->By color.
  4. In the image, click in the white portion, in order to select everything white. All white material selected
  5. Rightclick, Edit->Clear, in order to clear selected material to transparent. White cleared to transparent
  6. Rightclick, Select->None, in order to clear all selections. Nothing selected, ready to save as .xcf You now have the signature on a transparent background, and are ready to save.
  7. Rightclick, Layers->Layers, channels and paths.
  8. Create a new transparent layer called "line" and move it to the bottom.
  9. Draw your blue line on that layer. Line on underneath layer
  10. Rightclick, Layers->Layers, channels and paths.
  11. Create a new, white layer called "white" and move it to the bottom. Added white background layer
If you don't like the light gray outlines between the black letters and the blue lines, manually set the offending pixels to transparent, or else to a darker blue. If doing it manually doesn't float your boat, you can do it automatically, although it will require some trial and error. Here's how:
  1. On the signature layer, select the area above the blue line.
  2. Magnify greatly, and find the lightest pixel sitting atop the blue line. This will be your color to select by.
  3. Right click, Select->By color
  4. On the By Color Selection screen, click the Intersect radio button, and set Fuzziness Threshold to a moderate value -- something like 36.0. The higher you set this figure, the more pixels will be cleared.
  5. Click the Close button on the By Color Selection screen.
  6. Right click, Select->By color
  7. Click the lightest pixel sitting atop the blue line. This will highlight the lightest several pixels sitting atop the blue line, while leaving darker pixels, and all pixels not sitting atop the blue line, alone.
  8. Right click, Edit->Clear, in order to clear these light pixels and let the blue line show through. The result is a more realistic looking signature over line, without the telltale light gray outlines. Irritating light gray outline removed
  9. If any annoying light gray outlines remain, repeat this procedure on top of all or part of the blue line. So in the screenshot immediately above, I might want to get rid of the gray above the bottom of the S, and below the bottom of the L. With last couple irritating light gray sections removed

Using Gimp to Fill In .pdf Forms

Some .pdf forms allow you to fill them in, but most don't. In the old days your choices were  a pen or a typewriter -- neither particularly appetizing. Now you can use Gimp to fill in the forms.

What you're going to do is open the .pdf in Gimp, place a transparent layer on top of the form, type the information on that transparent layer in the blanks provided, and save as a native Gimp document (.xcf).

Short Instructions

For those of you who regularly use Gimp and just need a quick reminder of how to do this process, here are a short set of instructions:
  1. Open the .pdf in Gimp
  2. Choose 150dpi, heavy text antialiasing, light graphic antialiasing
  3. Each page becomes a separate drawing
  4. Save each page as a .xcf (Gimp native)
  5. Create a new layer called "typewriter", transparent, on top, and save again
  6. Choose the "typewriter" layer.
  7. Use the text tool to fill in the blanks (on the "typewriter" layer)
  8. Edit as necessary, save frequently
  9. Print
  10. Save as xcf, and for posterity save in a ubiquitous format like .jpg.

Complete Instructions

Here are the complete step by step instructions:
  1. Open the .pdf in Gimp
  2. Choose 150dpi, heavy text antialiasing, light graphic antialiasing as follows:

  3. pdf import screen
  4. Click OK, and notice that each page becomes a separate drawing
  5. Save each page as a .xcf (Gimp native)
  6. For each page, do the rest of the steps...
  7. Right click drawing and choose File/Layers/Layers, Channels & Paths..., and note that the "Layers, Channels & Paths" dialog appears, as shown following:


  8.  
  9. Click the "New Layer" button () to bring up the New Layer Options dialog, as shown following:

  10. Name the new layer "Typewriter" and make sure the Layer Fill Type is "Transparent". The width and height should default to the right quantity.
  11. Click the OK button to return to the "Layers, Channels & Paths" dialog, and note that the Typewriter layer appears above the Background layer (if it doesn't, use the up and down buttons to fix that):

  12. Click the Typewriter layer line to choose it. This means that editing will be done on this layer until you use the "Layers, Channels & Paths" dialog to choose a different layer.
  13. Right click, then File/Save as, and choose a name with the extension .xcf, which is the extension for native Gimp files. Make sure the "Determine File Type:"  choicefield reads "By Extension", and then click OK to save the file.
At this point you have the equivalent of a layer of clear plastic wrap on top of your form. You can write to your hearts content on the wrap, and erase it without erasing the form. This means you can move text around at will without changing the form itself.

To fill in the form, simply use the text tool, on the Typewriter layer, to fill in the blanks. Edit as necessary, save frequently. When finished, you can print your .xcf file and you get an almost perfect reproduction (it will be a little smaller than the original, and I haven't figured out a way to get around that yet).

As already stated, you  save it as an .xcf file so you can work on it some more, or use it as a template for something else later on. However, you might also want to save it as a .jpg, because the .xcf format is very unusual, and its possible in 10 or 20 years Gimp won't exist, but you know there will be tools to retrieve .jpg files.

Construction Lines in Gimp

Gimp's rulers and high magnification potential make it perfect for exacting work. Sometimes you need construction lines in order to complete that work. There are two ways of making construction lines in Gimp:
  1. Real Gimp construction lines
  2. Drawn lines on a different layer
By far the easier of the two is to use the construction lines provided by Gimp itself. To make a horizontal construction line all the way across the drawing, click the top ruler and drag the horizontal construction line where you want it. The construction line will not show in printouts. You can move the construction line any time you want by clicking the "Move layers & selections" button (Move button), and then dragging the construction line. Be careful though, because if you miss the construction line, you'll drag the entire selection or frame, which is the last thing you want to do. If that happens, Ctrl+Z undoes the last action (and there's an undo stack, so you can undo several actions). But the good news is that when the little pointing finger is on the construction line, the construction line changes colors. Construction lines can be moved in any layer, even if it's a different layer than the one in which they were created. This is a time saver.

To make a vertical construction line, click and drag the left ruler, and manipulate it the same way you would a horizontal construction line.

Construction lines survive sessions. To get rid of construction lines, just drag them back to the rulers.

Occasionally you might want your construction lines to be drawn lines. Perhaps you don't want them going all the way across the screen, or perhaps you want them to print on your printer in certain situations. In that case you can draw them as actual lines on their own layer (I call the layer const_lines). You can show and hide the lines simply by clicking the eyeball (or the place where the eyeball would be) on the layer dialog box. NEVER make drawn construction lines on a layer containing graphics, as it would be impossible to separate them from the graphic.
 
 
 

See also "The Lazy Man's Way to Screenshots"

 

Back to Troubleshooters.Com * Back to Linux Library