distros recommended by gnu:

This is a very basic tutorial I wrote in 2006, in response to a question about the GIMP's use of layers. It also covers XCF, the GIMP's native format, which enables you to save all layers without merging them.

To get the most out of The GIMP, take a look at the documentation; on-line tutorials are also available.

Now that I re-read this a year later, I realise that the steps given here aren't always the best or quickest way to accomplish some things; but they all work and will give you a beginning grasp of how to use layers.

Think of layers as multiple superimposed panes of glass, on which you can create images or parts of images.  Layers offer an extra advantage, because you can vary their opacity to create different effects.  You can also move them up and down in the stack. Visually, they combine to make one image.  Layers higher in the stack are superimposed on lower layers.

When you save an image with layers in most formats, you're prompted to export it, since such formats can't retain multiple layers.  Thus, once exported to another format such as PNG or JPG, you can no longer re-open the image and work with the individual layers making up the image.

However, if you save in .xcf format, the layers will remain available when the image is re-opened in the GIMP.

Any multiple-layer image which you may want to tweak later should be saved in .xcf format, and a copy saved in whatever other format needed for immediate use.  The .xcf format isn't for use on the web, etc.  Not only is .xcf filesize high because of the layers (essentially, multiple images contained in one image), but the format isn't readable by most other apps.

This tutorial will show you how to use layers in creating and editing a simple image.  The same techniques for working with layers and saving in .xcf format can be used for other more complex image work, including photo-editing.

The demonstration is a based on the KDE button I made for my website.  I wanted something the same size and "look" as the Debian button I found in this gallery of Debian buttons, but with a blue gradient, instead of silver.  I obtained the kde font, Kabel, as well as some logos from the KDE Clipart page.

If you'd like to recreate the KDE button following these instructions, here are the images to work with.

First, the Debian button, from here: Debian GNU/Linux OS
The KDE logo, already resized: kde-logo.png
You can obtain the Kabel font from KDE.

You can familiarise yourself with the parts of the Layers, Channels, Paths dock we'll be using here:
LCP-tools.png


And here are some of the tools we'll use:
Gimp-main-tools.png


Tools are also accessible by keyboard shortcuts (which you can customise in the GIMP's preferences dialogue), and from the menu available on each window (Tools >).

For a thorough documentation of the GIMP, see the GIMP User Manual.



PART 2

Open the Debian button with the Gimp.  Save it as "button.xcf" by going to File > Save As.  A save dialogue will appear, allowing you to choose file name and place to save.

Then, copy a small sliver from the blank portion of the button.  Use the keyboard shortcut R for the Rectangle Select tool, then click on the image and drag to select the desired portion.  Use Edit > Copy to copy it.  You will only copy what appears in the selected portion.
deb-btn-copy-sliver1a.png
newImg-sliver.png
Then use Edit > Paste Into to paste the sliver into the blank new image.
(You could also use Edit > Paste as New after copying the sliver.)
Use Image > Scale Image to scale it at least as wide as the centre part of the button.
ScaleImage-1a.png
Keep the height the same (26px).  Note that you will need to unlink the width and height, or the proportions will remain the same, which you do not want in this case.  The button to unlink width and height is shown circled in red.

blankSliverResized.png
After resizing the image, return to the original button.  Create a new layer:
newLayer-Layers.png
NewLayer.png
Then select the inner portion of the Debian button;  we want to keep the borders, so we won't have to re-make the shadow and highlights on the button edges.  About two px in should do it (it may help to increase magnification to at least 200% for this):
bntDeb-rectSelect.png
Use Edit > Paste Into to paste the resized blank sliver into the selected portion.  The edges will remain unaffected, even though the blank was wider than the selected portion.
You will now need to anchor the floating layer:
layers-floatingsliver.png
You can do this by clicking on the Anchor button in the Layers Channels Paths window, or by going to Layer > Anchor LayerCtrl+H,  or clicking on the image dialogue, outside the image, while the Rectangle tool is selected.

At this point, if you're satisfied, you may want to merge the blank background with the original button: Layer > Merge Down.
s-button-begin.png
As an afterthought, it would have been easier to: copy the selected sliver; paste into and create new layer from floating layer; resize that layer (layer > resize layer) after unlinking.

In the next step, I'll colourise the button.

note: screenies show the GIMP with a Crystal icon set.

Top

PART 3

Next, creating a colourised version. The first step is to create a duplicate layer to work on. That way, you can always try several different versions, and have the original to fall back to. Press the "Create Duplicate Layer" button in the Layers, Channels, Paths dialogue:
s-2-layer-duplicate-1c.png
Colourise this layer by going to the Colourise menuitem: Layer > Colours > Colourise …
s-3-colourise-1c.png

Then use the dialogue to get approximately the colour you want:
s-4-colouriseDialogue.png

After this, you can adjust (radically if desired) the colour by means of a number of tools. One very useful one is the Hue–Saturation dialogue, accessible through Layer > Colours > Hue–Saturation:
s-5-H-S-menu.png
The Hue–Saturation dialogue:
s-7-HLS-dialogue.png

You may want to rename the layer now. Double–click on the name in the Layers dialogue, and a textbox will appear:
s-7-renameLayer-1b.png

At this point, the button looks like this:
screenie-btn-blueblank.png

Next, I'll put the KDE logo in.

Top

PART 4

Now we're ready to put the KDE logo in. I've already resized a large KDE logo I've chosen. I need a new layer to put it in. Press the "New Layer" button in the Layers Channels Paths dialogue:
s-9-CreatenewLayer-1c.png
And you will get the new layer dialogue. Not much you need to adjust in this one, except the name. Make sure the background is transparent.
s-newLayer-dialogue-1b.png
Make sure this layer is selected, before pasting into the image:
s-9-newLayer-selectLayers-1b.png
Use Edit > Paste to paste the logo in.

Now that the image is pasted in, you need to anchor it. Use the Anchor button; or Ctrl+H; or Layer > Anchor Layer, or use R to change to the Rectangle Select tool, then click on the dialogue outside the image.
s-10-pastingLogoIn-LayersFloat.png

screenie-btn-logo1.png
We need a bit of shadow for the logo, to create a more 3D effect. Make a duplicate layer of the logo to work on. Select the lower logo layer to work on.
s-12-logo-duplicate-1a.png
In the Layers Channels Paths dialogue, make sure the lower logo is selected. (Don't panic if you accidentally darken the upper logo; you can always move a layer up or down in the layer stack if needed.) There are several ways to get a darker version. One way is to go to Layer > Colours > Brightness–Contrast. For this image, which has very light borders which I want to become very dark for a shadow, I simply inverted the colours: Layer > Colours > Invert.
s-13-invertLogo.png
s-14-logoInvertedSelected-1a.png
Since the two versions, light original and dark, are directly on top of each other, the light one masks the lower, and there's not much shadow. We need to move the lower one ... in this case, 1 pixel to the right and 1 pixel down. Make sure the dark logo is checked in the Layers Channels Paths dialogue, then Ctrl+A to select that entire layer, then R to give you the Rectangle select tool so you can move it. (You can also select the "move" tool in the main dialogue, or use Tools > Transform Tools > Move. The keyboard shortcut for this is "M.") It helps to increase magnification to 200% for this. Left-click and hold down, carefully moving the dark logo. Release and anchor.
s-15-logoInvertedMove.png
It's too dark as is. Go to the Layers Channels Paths dialogue, and use the slider (or spinbuttons) to adjust opacity of the dark logo (shadow) to taste.
s-16-logoInvertLayerOpacity.png


Next, I'll insert the text.



Top

PART 5

The next step is inserting the text.
I like to use a "scratch-pad" image to work with text, then when I'm satisfied, copy and paste that into a layer in the real image. File > New Image brings up the New Image dialogue:
s-17b-newImageDialogue.png
You'll need to make sure you have a transparent background in the "advanced" part. (The default can be set for this in the GIMP's Preferences.) I like plenty of space to work in, so I've chosen 200px x 200px.
Choose the colour desired for the text. You can double-click on the foreground colour rectangle to get a colour-chooser dialogue. I want a neutral light silver, and since I can reduce opacity of the white text over the black, all I really need here is to choose white by switching from foreground to background colour.
Colour-select-1b.png
Selecting the text tool in the main GIMP dialogue brings up the text dialogue. I select Kabel, which is the font used by KDE in their logos, and which I've already obtained from the KDE website. Note that you can also choose font colour here.
Text-dialogue-white-1b.png
Place your cursor in the upper left quarter of the blank image. When you click it, the text creation box will appear. Type into it, and the letters will appear in the image.

blankNew.png
s-20-text-typingDialogue.png
Sometimes you have to try a few different font types and sizes before you get one you like.  Just click in a different part of the "scratch pad" image to place text in another area.  I like to merge each text layer down into a single layer in my "scratch-pad:" Layer > Merge Down.
When I'm satisfied with the text, I use the keyboard shortcut R to get the Rectangle Select tool, and select that bit of text. Then Ctrl+C or Edit > Copy copies it.
s-22-copyText-tr.png
Again, create a new layer in the button image.
newTextLayer-LCP.png
newTextLayer.png
Edit > Paste Into pastes the text into the image. Adjust the positioning as needed.
text-pastedIn.png
Then, anchor the text in the text layer.
text-pastedAnchored-LCP.png
Then, I need to give the text some 3D shadow effect. Once again, create a duplicate layer, and work on the lower layer.

text-duplicateLayer.png
If I were working with coloured fonts, I might want to do something subtle with the Brightness–Contrast dialogue, or maybe use the Hue–Saturation dialogue. For this, though, inverting the colour is sufficient: it turns the white text black. (Layer > Colours > Invert)

text-duplicateLayer-inverted.png
Then, the keyboard shortcut M selects the Move tool, and I move it down and to the right 1 pixel. Next, anchor the layer.

text-invertedMove.png
Since this is a darker shadow than I want, I use the opacity settings to reduce the black text considerably. I also reduce the white text opacity slightly, and make a slight adjustment to the blue layer opacity.

text-shadow-opacity.png
Alternatively, The GIMP can automatically create a shadow effect: Script-fu > Shadow > Drop-Shadow.

Although I'll be using a PNG version of this, I make sure to save the finished button in .xcf format first. This preserves all the layers intact and separate, so I can open it again later and tweak any layer.

Then, I save in a format I can use on the web. For this, I choose PNG. JPG would probably also be acceptable, and can give a better file-size, although it doesn't handle text or areas of solid colour well. Since PNG is a lossless format, it's safe to use maximum compression (9).

saveDialoguePng1.png
png-export.png
png-save-dialogue.png


The finished button:
KDE Desktop Environment




Extra tips:
Edit > Copy Visible copies what you see in the image: all visible layers.
Edit > Copy only copies the current layer, or the portion of it selected.



Top

All information, themes, and builds provided  "as is without warranty of any kind … .  The entire risk … is with you."