Home > Articles/Tutorials > Framing with the GIMP Part 2: Bring on the Gradients!

Framing with the GIMP Part 2

By Robert Spotswood

Bring on the Gradients!

This tutorial builds on the previous "Framing with the GIMP" tutorial published in the Jan-Mar 05 issue of HAL-PC Magazine. The previous tutorial can also be found on-line at http://www.spotswood-computer.net/articles/gimp_framing1.php. Concepts and techniques covered in the previous tutorial will not be repeated here. If you haven't read the previous tutorial yet, please do so before starting this one. You should also note that computer screens can show much finer lines and detail than the magazine can. Thus the pictures will look better on your screen than shown in the print version of HAL-PC magazine.

Gradients

A gradient is simply a set of colors arranged in a linear order. Sometimes the colors make a transition from one color to another. A rainbow is a naturally occurring example of a gradient. Figure 1, below, shows a rainbow like gradient with smooth color transitions.

Figure 1: A simple, rainbow-like gradient with smooth color transitions.
Figure 1: A simple, rainbow-like gradient with smooth color transitions.

In the GIMP, "transparent" is also a color, and this is one of the two keys to making frames (some 3-D!) with gradients. Unfortunately, the GIMP 2.4 and earlier comes with only one pre-made gradient suitable for creating a frame, called "Square Wood Frame". However, you can download other pre-made gradients and add them to the GIMP's collection or even make your own.

A group of eight pre-made gradients designed for making frames can be downloaded from http://www.spotswood-computer.net/gradients.zip for the GIMP 2.0 and higher, or http://www.spotswood-computer.net/gradients_12.zip for the GIMP 1.2. Download the file and unzip it into in a folder called "gradients" in your personal GIMP directory, or the system gradients directory (if you want everyone who uses that computer to be able to use the new gradients).

To find the locations of both directories, go to File -> Preferences in the GIMP and under Folders (or Directories for the GIMP 1.2), you will find Gradients. This lists all the places the GIMP will look for gradients on startup. After unzipping the gradients to the appropriate directory, restart the GIMP so it will find the new gradients.

Using the Gradients

Using the gradients to create a frame is very simple. First, open a picture you want to frame. The frame will cover part of the picture and some frames will cover more than others. Square Wood Frame covers a lot! Select the blend tool (figure 2 below, circled in red) and double click on it to bring up the properties window (also shown in figure 2). Chose your frame gradient by clicking on the picture of the gradient (circled in blue). GIMP 1.2 users will need to pick "Blend: Custom Gradient" instead of clicking on the picture of the gradient and also be sure the active gradient is the frame gradient you want to use. Be sure Shape (circled in green) is "Shaped (Angular)", also called "Shapeburst (Angular)" in the GIMP 1.2.

Figure 2: Tool settings used for frame drawing.
Figure 2: Tool settings used for frame drawing.
Figure 3: Tool settings used for frame drawing for GIMP 1.2.
Figure 3: Tool settings used for frame drawing for GIMP 1.2.

To create the frame, just click and drag your mouse on your picture in any direction and distance, then release the mouse button. Viola. You now have a framed picture (see figure 4 below). Normally the starting point, length, and direction of the drag affects the way a gradient is drawn, but not for "Shaped (Angular)".

Figure 4: A picture framed with a gradient.
Figure 4: A picture framed with a gradient.

Showing the Whole Picture

The above method works fine if you don't mind covering up part of your picture. But what if you don't want to cover part of your picture? It takes a little trial and error, but it can be done. However, this method does change the aspect ratio and increases the picture's size, so further size adjustments may need to be made beyond what is described in this tutorial.

First you need to increase the frame size (covered in detail in "Framing with the GIMP" part 1). This is one case where you want to unlock the aspect ratio, or the width of the picture divided by the height. An 8 x 4 picture has a ratio of 2:1 as does a 16 x 8 picture. The GIMP automatically computes the ratio and any size adjustments you make on the height or width will affect the other dimension unless you unlock the aspect ratio.

Right-click on the picture and chose Image->Canvas Size or use the menus. Click on the chain (circled in red, figure 5 below, shown unlocked) to unlock the aspect ratio. Then adjust the height and width until you get a wide enough empty area around your picture (this is where the trial and error part comes in). With the chain broken, adjusting either the height or the width does not change the other at all. With the chain unbroken, adjusting one automatically adjusts the other.

Figure 5: Expanding the canvas to make room for the frame.
Figure 5: Expanding the canvas to make room for the frame.

Use the center button (circled in green, figure 5) to center your picture and be sure the X and Y offsets are equal. In this case, 48pts of offset worked out to be about the right size for a picture originally 1601 x 1064 pixels using the gradient "frame-tube_wood". Different frame gradients can be different widths, so this will take some trial and error to get an acceptable offset size.

Figure 6: Adding the layer to hold the frame.
Figure 6: Adding the layer to hold the frame.

Now you need to add a new layer (see figure 6; this was also covered in the previous tutorial). The GIMP will not create a gradient frame on a transparent area, so you must fill this new layer with a solid color different than the frame colors. White usually works well. This completely covers your picture, but don't worry. This is normal. Now on the white layer, create/draw your frame gradient as described above (see also figure 7 below).

Figure 7: The layer with the frame before erasing the white area.
Figure 7: The layer with the frame before erasing the white area.
Figure 8: The magic wand tool.
Figure 8: The magic wand tool.

Next select the magic wand tool (icon shown in figure 8 below). Now click anywhere on the white area. A set of marching ants will now encircle the white area that is left. Now you can erase the white area by either going to Edit -> Clear or pressing Ctrl-K. Figure 9 is the result. Compare the hole in the clouds on the right side of the picture with figure 4. Notice how none of it is chopped off in figure 9. Compare the holes in the clouds on either side of the picture.

Figure 9: The frame on the expanded canvas.
Figure 9: The frame on the expanded canvas.

Showing the Whole Picture with Matting

If the above seems like too much trial and error, and you don't mind some matting showing, there is an easier way. Start by increasing the canvas size as described above, except in this case, you can leave the aspect ratio locked (i.e. don't click on the chain) if you like, although the final result does look better if the X and Y offsets are the same. Be sure to click on the center button (see figure 5) before you click on resize (this also shows you the X and Y offsets).

Next, add a new layer as described above. Now click on the down arrow to lower the new layer below the old one (see figure 6, it's to the right of the green circle) and fill the new layer with a color of your choice (described in detail in the previous tutorial). If you get an error message, you may need to add an alpha channel to your original layer (also described in the previous tutorial).

Finally, draw the frame as described above. If you sized the canvas correctly, a band of the fill color, or matting, gray in figure 10 below, will be visible all around the picture, as shown in figure 10. This picture, originally 1601x1064, used an offset of 96 for both X and Y.

Figure 10: The frame on the expanded canvas with matting.
Figure 10: The frame on the expanded canvas with matting.

Conclusion

Using gradients to draw frames is an easy way to add that special touch to your pictures and it takes only moments to do. Combine this with the matting techniques described in the first "Framing with the GIMP" and your frames can become works of art in and of themselves.