05 Lesson 3: Introduction to Layers and Text

In this lesson, we'll begin working with layers, and in the process,
we'll make a simple greeting card. With Valentine's Day coming up,
I'll make a Valentine's card as my example. Of course you're free
to make anything you want -- a friendship card, a poster for a
project, or perhaps just a picture with a funny caption to put on
the web or post on your wall.

I'm posting this lesson a day early in case there's anyone who wants
extra time to make a card before Monday.

THE LAYERS DIALOG

I know layers sound intimidating. I avoided using them for a long
time myself. But once I finally took the plunge, I realized they were
really a lot simpler than I'd thought -- I wished I'd taken the plunge
much earlier!

To work with layers, you'll want to make sure the Layers dialog is
showing. Once you learn how to work with layers, you'll probably
want this dialog visible all the time. GIMP turns it on by default,
but in case you closed it at some point, it's easy to get it back: use
the Toolbox window, File->Dialogs->Layers. In gimp 1.2, it's called
"Layers, Channels, and Paths" but it's still in File->Dialogs.

We'll talk about channels and paths in later lessons; for now, you'll
only need the leftmost tab in the dialog, "Layers".

THE BASE LAYER

The first step is to choose the perfect image for your card. I found
just the thing in a batch I took at the SF Zoo a few years ago:
http://shallowsky.com/images/gimpcourse/lesson3/penguin-orig.jpg

If you're going to be printing your image out, use as large an image
as possible (a 2 megapixel camera image is plenty for a half-page
card, a 1.3 megapixel image is probably fine if the recipient isn't
super picky). If it's for the web, you're probably best off using the
size you're going to use in the final web image, because text often
doesn't look as good when it's resized. Open your image in gimp, and
crop/resize as needed. Leave some space for text, though.
(I'll post my examples resized for the web, though I'm actually
working on a full-sized image since I'll be printing mine.)

SET THE TEXT COLOR

Before we actually create the text, we need to choose what color it
will be. In the toolbox, right under the rows of tools, are two
squares (one on top of the other) showing two colors: probably
black in front, and white behind it. These are the current foreground
and background colors.

Change the foreground color by clicking on the foreground color (the
black square). Gimp's color picker window will pop up.

In-depth use of the color picker is a topic for later, but for now,
either use the sliders next to R, G, and B (for Red, Green, and Blue)
to choose a color; or drag up and down in the rainbow column to change
the hue, then drag up and to the right in the big shaded box to make
the color brighter; or (in gimp 2) click on one of the predefined
colors. The color you pick will show up under Current, and also
back in the toolbox window in place of the black square. I'm picking
yellow.

MAKE SOME TEXT

Select the Text tool: click on the T in the toolbox. Then click
somewhere in the image. I click generally near where I want the text
to end up, but it's not critical; we'll position the text later.

The text dialog pops up. This is very different depending on version.

Gimp 2: the dialog itself just has a textarea where you can type in
your text. Type your desired text here (multiple lines are okay).
All the other options are back in the tool options dialog:
this might be visible as a separate dialog, or it might be "docked"
in the toolbox window underneath the fg/bg color swatches. If all
else fails and you can't find the text options, try, in the Toolbox,
File->Dialogs->Tool Options and see if it pops up.
Once you've found the Text Options, you can use the menus there to
change font face and size, and other details like color and spacing.
Happily, gimp shows a live preview in the image window, so you can
fiddle with things and see what happens.

Gimp 1: The dialog is much bigger and has the font and size pickers
right there, as well as the preview. But there's a confusing gotcha:
the preview in the dialog shows the font as it will look when the
image is at 100%. If the image is zoomed smaller, then once you
click OK in the dialog, the font will show up that much smaller.
You may find that you have to try it, then Undo, then try it again
with a different size, several times before you get it the size you
want.

In both gimp 2 (during the preview phase) and gimp 1 (after you click
ok), the text is surrounded by dotted lines and it's hard to tell
exactly what it looks like. Right now, just get it the right size,
and click OK or Close.

My image with some text added:
http://shallowsky.com/images/gimpcourse/lesson3/penguin-text.jpg

WORKING WITH LAYERS

Look at the Layers dialog. Notice that while there was only one entry
there before, now there are two: one for the base image, and one for
the text. You're working with layers now!

In gimp 1.2, the text layer will be labelled as "Floating Selection".
(Gimp 2 users can skip this paragraph.) That means i's a sort of a
fake temporary layer. We'll be working with real layers here, so you
need to convert it. To do that, go to the button at the bottom left
of the Layers dialog, with a "new document" icon (like a piece of
paper with one corner folded over) -- if you hover over it, the
tooltip says "New Layer". Click this, and the layer's name should
change to "Text Layer".

Why a layer? Gimp could have just painted your text right on the
image. But because it's in a layer of its own, you can move the text
around, change it, or delete it, without risking any damage to the
original photo below.

The first thing we're going to do with the text layer is move it.
Go back to the toolbox, and find the Move tool. It's a pair of
crossed arrows, one vertical, one horizontal; it's probably right
above the T of the text tool, and its tooltip says "Move Layers &
Selections". Click it.

Now move your mouse back into the image, move the mouse slowly toward
the text, and watch the cursor carefully. In most of the image, the
cursor should look like a pointing hand, but as you move over the new
text, the cursor should change to the crossed arrows of the Move tool.
It's good to get in the habit of watching the mouse cursor as you move
in the image: a lot of gimp's tools will change the cursor like this
to give you clues about what you can do.

Once you're over the image, and seeing a Move cursor, hold the left
button down and drag the text layer to exactly where you want it
in the image. The beauty of layers is that if you change your mind,
you will be able to move the layer again at any time.

Tip: When you want to move a specific layer, first make sure that
layer is selected in the Layers dialog. That way, you can watch the
mouse cursor to make sure you're moving the right layer. You *can*
click on another layer, and gimp will switch to that layer and start
moving it instead, but when you have several layers built up, that
can get confusing. If you do move the wrong layer, though, "Undo"
works to undo a layer move.

At this point you have a fairly nice card! You can add more text,
in different colors or fonts. Adding the person's name is a nice
touch, so they know you made it for them personally.
Make a separate layer for each new piece of text. If you want
to go back and move one of the earlier layers, you can click on
that layer in the Layers dialog to make it the active layer.

SAVE AS XCF

If you want GIMP to remember details such as layers, you have to use
GIMP's native format: XCF. So, the first time you save,
use an image name that ends in .xcf. Now you can read the image back
in at any time and not lose any details.

XCF is big. You don't want to put an XCF on the web, unless you're
collaborating with another gimp user. Web browsers can't view it anyway.
But it's the only format to use when you're working on an image
with lots of edits.

When you have your image finished, if you want to put it on the web
or mail it to someone, you'll want to make a copy in some more common
format, such as .jpg. In gimp 2, you can "Save a Copy" (in the file
menu) to filename.jpg. But gimp 1 doesn't have "Save a Copy", so
you have to use "Save as" to filename.jpg, which changes the image's
current name, so if you make more changes and want to save to xcf
again after that, you have to use "Save As" again.

Finally: when you save to another format, like jpg, gimp will warn
you that jpg can't handle layers, can't handle transparency, etc.
Just click Export and let gimp handle the conversion.

LAYER VISIBILITY

Notice, in the Layers dialog, how each layer has an eyeball icon to
the left of it? This controls visibility of the layer. Click on the
eye, and the layer becomes invisible. Click again where the eye used
to be, and it becomes visible again.

When you save to a format other than XCF, gimp will save the image
as it looks to you. So if you have a layer that's invisible, that
layer won't show up when you save a jpg or png.

You can use this to make a card with several alternate sets of text.
For example, you could make one text layer that says "To Fred", and
another text layer that says "To Joe", and use the eyeballs to turn on
only one at a time, and save to fred.jpg and joe.jpg. Just hope Fred
and Joe never get together to show each other the cool Valentine's
cards they got from you! :-)

DROP SHADOW

One final note. In my penguin card,
http://shallowsky.com/images/gimpcourse/lesson3/penguin-text.jpg
the area around the text is very busy, which makes it hard to read
the text. An easy trick to make the text look prettier, and make
it easier to read against a mixed background, is to use a "drop
shadow".

In a later lesson we'll see how drop shadows are made, but
you don't need to know that now. In the Image window,
Script-Fu->Shadow->Drop Shadow will make a dandy one for you
as long as you have the text layer selected. Notice that
when you make the drop shadow, it shows up as a separate layer.
So you can toggle it on and off with the eyeball icon, and compare
the effects. You can even make several different drop shadows,
changing the parameters in the Drop Shadow dialog, and toggle
them on and off to see which one you like best. You can also
move the drop shadow layer separately from the text layer, to
move the shadow closer to or farther from the text.

Here's my card with a drop shadow added:
http://shallowsky.com/images/gimpcourse/lesson3/penguin-val.jpg
and the XCF of it is
http://shallowsky.com/images/gimpcourse/lesson3/penguin-val.xcf

HOMEWORK: Show off your card, cartoon, or whatever you made.

Next lesson: I'll post an optional mini-lesson on printing in a day
or two, for anyone who wants to print a physical card, including
suggestions for people who don't have a color printer.