Layers
In this chapter we'll discuss the very foundation of effective image manipulation - Layers. What they are and how to use them.
I have heard that some Gimp-users find the concept of layers hard to grasp. It shouldn't be that way though, because using layers is really as simple and straightforward as wearing layers of clothes on your body. Once you have started to use layers, you won't understand how you could ever do without them! Adding layers to your image
Open the Layers & Channels dialog box in the Image-Layers menu. The dialog box has an Image menu, where you can see the name of your image. If you are working with several images this is very useful, because all open images are listed here, and you can choose the one you want to work with by clicking its name.
The dialog
There are two tabbed folders - one for Layers, where you are now, and one for Channels (Channels will be discussed in Chapter 18). There is also a drop down menu for Modes, an Opacity slide bar, and a Keep Transparent button.
There are also five short cut buttons at the bottom of the dialog. They are (counted from the left) New layer, Raise active layer, Lower active layer, Copy active layer, Delete active layer and Anchor floating selection, all of these options will be discussed later in this chapter.
In the window, you will see a thumbnail icon of your image. There is an eye symbol to the left of it, and you can see that your image is called Background. Try clicking at the eye, and you'll find that your image disappears! Click again and it comes back. The eye symbol allows you to toggle on/off layers, so you can work with a particular layer without having to see all other layers. If you SHIFT-click on an eye icon, all layers except that one will be hidden from view. To toggle on the other layers, SHIFT-click again. Now, press the right mouse button with the cursor placed on the thumbnail image or the layer name. This brings up a Layers menu with a few more options than the regular Image Layers menu (the one you get when you right-click in your image). Choose the first option on the list called New Layer.
New layer
When you choose New Layer, you'll get a little dialog box asking you some questions about the new layer. Here you name your layer. You can for instance call it "shadow" if you mean to create a shadow of an image object in this layer. It's a good idea to name your layers if you work with many of them, especially when you use similar layers with different functions. You can also change the size of the layer, but you don't really have a reason to do this, unless you know exactly what to put in it. The last thing to decide is what layer fill you want. The options are; Background, meaning your current background color in the toolbox, White and Transparent, where transparent is the default fill. Press OK, and you have created a new layer on top of your background. The active layer
Now, when you have two ore more layers, it's really important to know which one is the active layer. The active layer is marked with blue color in the dialog box, and you can make another layer active by clicking its name beside the thumbnail. As soon as you have several layers in an image, Gimp reacts only to the active layer, so you can only work in one layer at a time.
If a layer is smaller than the background, you can also make it active by clicking in it with the Move tool. If you want to move a transparent layer, or just make sure that you move the right layer, press the Shift key as you drag. This will ensure that only the active layer is moved. When the selected layer's boundary changes color from yellow to blue, you know that it's safe to move it. Also see chapter 9 about the Move tool.
Symbols and explanations
If you click beside the eye symbol, you'll get a new icon - a little anchor symbol. This enables you to link some of your layers. Linking layers means that all layers with the little anchor symbol are locked or grouped in relation to each other, so you can't move one layer without moving the others at the same time. Only remember to unlink the layers before moving another layer, otherwise you'll move all of the layers even if the linked layers aren't active.
To understand the Keep transparent button, you first have to draw something in a transparent layer. Make the layer active, and paint something with the paintbrush (with the button unchecked, which is default). Now, press the button, change the color of your paint, and start painting again. You'll find that you can only paint the opaque areas - i.e. the ones you already painted. The purpose of Keep Transparent is to protect the boundaries of opaque shapes in a transparent layer. It also makes it very easy to change their color, you never have to worry about painting outside of edges etc. If you want to use a filter on a layer, you usually don't want this option checked, because then you'll only get the filter effect inside of the shape.
Naming
If you want to rename a layer you just double-click on the layer's old name and you'll get a dialog where you can type the new name. Remember that your original image was automatically named Background? The background layer doesn't react quite as the other layers, because it isn't really regarded as a layer - it's a fixed and solid area for layers to work against. The background works the same way as it did when you didn't have layers. When you cut parts of it, or use the eraser, the background color shows - not a transparent surface. You also can't use layer masks on it or raise it. Normally, you have no need to do these things on a background, but if you want to anyway (for transparent GIF's for example); double-click its name, rename it and it will behave like any other layer. You can also use Add Alpha Channel, or duplicate the background and erase the original.
These commands move the active layer to a higher or lower position in the layer hierarchy. You can only raise or lower a layer one step at a time, so if you want to move a layer near the background to the top, you have to keep raising it step by step, until you are satisfied with the position. The background layer can't be raised, unless you rename it or use Add Alpha Channel.
Makes a copy of the active layer, and places it immediately above the original.
Deletes the active layer.
Shrinks or enlarges the layer and its contents.
Changes the size of the layer, but not its contents. If the contents of the layer is larger than the new layer size, the image or selection will be clipped to fit the new size. There is also an offset option, where you can decide how the layer content is to be placed inside the new layer.
Description
This is an advanced option. You use a Layer Mask when you want to change the alpha values in a layer. If you don't know what alpha values are, read the chapter on Channels. How to
When you add a layer mask to a layer, you always work with a grayscale image (you can use colors, but they will appear as shades of gray in the mask). In the layer mask, black stands for transparent and white for opaque. When you choose Add Layer Mask, you'll first be asked what initial fill you want; white, black or layer's alpha. If you choose black, you start out with a transparent mask, white gives an opaque mask, and layer's alpha means that the mask will use whatever alpha values your layer has. When you have chosen the initial fill, a small layer mask icon appears next to the layer thumbnail. To switch between layer mask and layer you click at the appropriate thumbnail. To create the mask, you can do a number of things. With gradients
A very useful mask can be made from a gradient fill. A gradient results in the top layer gradually blending with the background. You can paint degrees of transparency where you want it, or use filter or a pattern to create an interesting mask. You can use selections, or paste an image into the mask. In short, this is an extremely versatile and powerful instrument.
Green and Red Mask display
To work with the mask, the little thumbnail is quite insufficient! Use ALT-click on the mask icon, and you'll see the grayscale mask instead of your image. Note that the mask icon is now lined with green. When you want to check the result of the mask, ALT-click again, and you'll see what your image looks like with the mask effect. To see your image without the mask CTRL-click on the icon; The thumbnail is now lined with red. CTRL-click again to return to the mask. You can also alternate between green and red display by ALT-clicking, but to enter and exit this mode you have to switch to red first.
Apply Layer Mask is used when you're happy with your mask, or if you're dissatisfied, and don't want to use it.The choice is clear - apply or discard.
Anchor layer is used for merging floating selections with a layer (the layer which was active before you placed the float). If you don't know what a floating selection is, check out chapter 18. Most of the time it's quite sufficient to mouse-click in the float to make it stick to a layer. Sometimes the Move tool has to be active for this to work (this is the case for anchoring floating Text strings), but the Anchor layer command always works, and it's fast to use, if you remember the short cut key for it (Ctrl-H, if you don't assign another key to this function).
This function merges all layers which have the little eye icon turned on. Invisible layers are not affected. The options Expanded as necessary and Clipped to image result in the same: the final layer is just big enough to fit all layers, but no larger. Clipped to bottom layer results in a final layer with exactly the same dimensions as the bottom one.
Merges all layers without exception. Remember that you must use Flatten Image before saving your image, if you mean to save it in any other image format than XCF and GIF. (Also, remember to erase your Alpha Channels, if you have made any in the Channels folder - many image formats and printers don't understand Alpha Channels).
Alpha to Selection is a very powerful command. Alpha to Selection is used when you want to transform opaque or semi-transparent shapes in a transparent layer to a selection.
This command is so useful, that you use it nearly every time you work with a layered image. Think of it, the form or shape of things is what you mostly work with in the different layers. If you work with an image of, say, a saucer, you'll want to place a copy of the saucer shape under the actual saucer to create a saucer-shaped shadow. Then, you want another saucer copy to accentuate highlights in the porcelain, and another to show dark areas, and another with a special pattern on it, and another...etc. Get the hint? Every time, you just want the empty shape or the selection of the saucer, not a copy of an image with a saucer in it. This is why Alpha to Selection is so important. The pure shape of an object in the form of a selection goes through all layers, you just activate the layer you want it in, and start working!
Mask to Selection is the equivalent of Alpha to Selection, but for masks. You usually don't use this option as often as Alpha to Selection, but if you've made a good mask it is great to be able to use it again in another layer.
If you wish to add alpha information (be able to work with transparency) to the background layer, you can use this option. There are other ways to accomplish this, but Add Alpha Channel is fast and easy.
- Collect: Top layer controls where the lower layers end up. Collect causes all lower layers to snap their chosen edge to the horizontal coordinate of the top layer's chosen edge.
- Fill (left to right): Places the layers from left to right, starting with the top layer. The distance from the chosen edge of a layer to the next is always the same. If the top layer's chosen edge is already to the left of the others, it will not change horizontal position.
- Fill (right to left): Corresponds to the above.
- Snap to Grid: The chosen edge will snap to the nearest horizontal grid line. A chosen corner will snap to the nearest node in the grid system you made.
Horizontal base
Horizontal base controls what edge the layers snap to or fill from.
- Left Edge
- Centre
- Right Edge
Vertical style
Vertical style controls how layers are positioned (vertically) in relation to each other.
- None: No change in vertical position.
- Collect: Causes all lower layers to snap their chosen edge to the vertical coordinate of the top layer's chosen edge.
- Fill (top to bottom): Places the layers from top to bottom where the distance from the chosen edge of a layer to the next is always the same. If the top layer's chosen edge is already to the top of the others, it will not change vertical position.
- Fill (bottom to top): Corresponds to the above.
- Snap to Grid: The chosen edge will snap to the nearest vertical grid line. A chosen corner will snap to the nearest node.
Vertical base
Vertical base controls what edge the layers snap to or fill from
- Top Edge
- Centre
- Bottom Edge
Collect
Collect is good for stacking objects in horizontal or vertical rows. If you want to place your layers exactly on top of each other, this is the option to use (choose Collect/Centre for both Vertical and Horizontal style/base).
Fill
Fill is good for animations where you wish to move an object with equal steps for each frame. If the layers are placed on top of each other, or very close together when you use Fill, you'll first have to move them apart to get an acceptable result. Moving small layers is very easy. Clicking on a small layer with the Move tool automatically makes that layer active, so you can drag and drop layers easily without having to choose them in the Layers dialog. There is no sure way of controlling the distance between layers, but as a rule, the maximum distance is achieved by spreading the layers as far as possible before aligning. Aligning with Fill several times, reduces the distance between layers. Each time you use it, the layers get closer, until the layers' chosen edges touch. A tip is to lock the layers after using Fill. If you link them with the anchor symbol, you'll be able to move all of the layers in the sequence to a suitable place in the image. Snap to grid
Snap to Grid is an indispensable option when you're planning an animation. The problem is that the grid you create with Grid size is invisible. To be able to use this option in a productive way, you have to make the grid visible. The solution to this problem is to create a new full-sized layer, use Grid in the Filters/Render menu, and set the size in this grid to the same as the invisible Align-grid. Remember that different layers may well snap to different nodes in the grid - each layer will snap to the node/line which is nearest to its chosen edge/corner. The best way to work with Snap to Grid is to place the layers close to the place you want them, and then align them perfectly with this option. If the grid system isn't enough for your needs, you can always correct the position afterwards by dragging Guides to the position you want, and use Snap to Guides (default in the View menu). Misc.
Ignore the bottom layer even if visible is set as default. This is wise in most cases. When you have created layers with a fix background, you don't want the background to start moving.
Use the (invisible) bottom layer as the base treats the bottom layer as any other layer, it aligns the background or bottom layer together with the other layers. Use this option if you want to make a GIF-animation with transparent background.
Grid size: Here you can set the size of the invisible grid. The grid squares measure up to 200 pixels.
With this tool can you import one or more layers from a another image. The source image can be bigger or smaller than the target image. The interface is simple and easy to use. There is a menu where you select an image to import layers from, and several options for selecting what layer(s) you want to import. You can make importing easier by bringing up the Layers & Channels dialog. As you can see in the interface, you can import the layers in the way they appear in the source image, or in reverse order. You can also choose what layers you want to import; linked (the little anchor), visible, selected or all layers. To import a layer, press OK or Apply. Pressing Apply will keep the dialog open after importing, so you can go on importing layers from other images.
When you add a small layer to an image, you may want to adjust that layer in relation to another layer or the image border. This tool will help you do this in several ways. You must first choose what layer(s) or image border you want Adjust to be relative to. The second choice is to specify the layer(s) you want to adjust. You specify these adjustments with four check buttons. As you see in the table below, there are sixteen different combinations:
Left Right Top Bottom Result X Adjust to the left. No vertical change. X Adjust to the right. No vertical change. X X Centre layer horizontally. No vertical change. X Adjust to the top. No horizontal change. X X Adjust to the top left corner. X X Adjust to the top right corner. X X X Centre layer horizontally, and adjust to the top. X Adjust to bottom. No horizontal change. X X Adjust to the bottom left corner. X X Adjust to the bottom right corner. X X X Centre layer horizontally, and adjust to bottom. X X Center layer vertically. No horizontal change. X X X Centre layer vertically, and adjust to the left. X X X Centre layer vertically, and adjust to the right. X X X X Centre layer in all directions. You can also select a layer in the drop down menu. It's wise to have the Layers & Channels dialog up, so you can set the layers that should be linked, visible or active. All these functions makes it easy to adjust several layers against the image border or another layer. You can for example use a combination where you adjust all linked layers against all visible layers.
Here's a possibility to move one or several layers in a more exact way than you can achieve by hand. In the drop down menu you select a layer to move. The slides set distance and direction of the movement. If you want to move more than one layer you have to check Affect visible layers or Affect linked layers or both. If you don't check any of these buttons, only the layer selected in the drop down menu will be affected. You must also choose how to move the layer(s); relative or absolute. With Relative, you will move the layer(s) with the selected layer's current position as reference. With Absolute mode, you will move the layer(s) with the image border as reference.
The Gimp User Manual
Last modified: 19 May 1998