Layers

Like selections, layers are a fundamental and very useful feature of the GIMP - you should use them often! Think of layers as being like transparent plastic sheets - one layer may contain an image or part of an image while at the same time allowing underlying layers to show through (the transparency of each layer can be adjusted). The order of the layers can be easily changed and layers can be added and deleted as required.

Display the Layers palette (Dialogs>Layers or Ctrl+L) and you will see something like this:

The new layer button , duplicate layer button and delete layer button do what you expect them to and many other options are available if you right-click a layer. The above palette shows that a second layer called 'Pasted Layer' has already been added on top of the background layer called 'Background'. New layers are always added immediately above the active layer so if you already have more than one layer you should think about exactly where in the stack of layers the new layer should be placed.

The eye symbol to the left of each layer indicate that both layers are currently visible - click an eye icon to hide the corresponding layer. The layer with the dark blue background is the active layer - any changes will apply to this layer only. Click the name of an inactive layer to make it into the active layer.

Clicking the empty square to the left of the name of an inactive layer links that layer to the active layer so that both layers can be moved together - click again to unlink. Linked layers are shown with a chain symbol like this:

To change the order of layers simply drag the layer's names into the desired position within the layers window. Exception: the background layer can't be moved. To make the background moveable, right-click it in the layers dialog and click 'Add Alpha Channel'.

Finally, note that you can adjust the opacity of each layer. Opacity is simply the opposite of transparency so decreasing the opacity means increasing the transparency.

For more help with layers, use the the GIMP help system, section 4.3.

Take a look at the photo below, which I took in the city of lights, Paris. It's a nice enough photo but the sky is a bit dull - let's replace it with a more dramatic one. The basic procedure will be to put the horse picture in one layer with the dramatic clouds in a separate layer underneath - we will select and delete the sky in the top layer making a transparent area which will reveal the clouds underneath.

Open the above picture in the GIMP. Remember: we want to select the sky and then delete it so as to create a transparent area which will later reveal the dramatic clouds in a lower layer? There's a catch already - our photo is in the 'background' layer which is special in two ways - it can't contain transparent areas and it can't be moved (we can't slip another layer underneath it). Solution: open the layers dialog (Dialogs>Layers or Ctrl-L) then right-click the background layer and choose 'Add Alpha Channel' (in computer graphics 'alpha' means 'transparency') - this won't change the name of the layer but will make the layer into a normal one containing not only channels for red, green and blue but also an alpha channel.

Now we want to select the sky, but what is the best way of doing that (think hard)? The horse has a complex shape so it would take forever to select it with the free select, scissors select or path tools. That leaves the 'fuzzy select' or 'select-by-colors' tools as possible options. Clicking the statue with either of these tools would never work well because the statue contains many shades of different colors but clicking the sky might work, for it is light blue all over. Or is it? It's actually a much lighter blue on the right than the left of the picture... Is it best to use the fuzzy select tool to select the sky or the select-by-colors tool? If you look carefully you will see the sky is actually broken up into about 10 separate areas so it might be better to use the select-by-colors tool, but I'll let you decide.

Pay attention now to the options of the tool you have chosen. I suggest you turn antialiasing on and feathering off (antialiasing is like very slight feathering - it blurs the edge of the selection a tiny bit). The most important setting is the threshold i.e. the range of colors that will be selected when you click with the tool. You really have to find this by trial and error so try a random setting, click the sky and see what happens. If you got the whole sky and nothing but the sky then congratulations - you got lucky! If you got more than the whole sky then reduce the threshold setting and try again. If you got less than the whole sky then you have two choices:

1) increase the threshold value and try again or

2) ADD to the existing selection by holding down the Shift key as you click or, alternatively, click the button 'add to the current selection' in the options window before clicking.

If you are using the fuzzy select tool then you will HAVE to use method two above at some point.

You should now have a pretty accurate selection of the sky but of course your selection is not perfect - it probably is missing tiny areas of sky along the edges of the statue. We really want to make sure we select the whole sky because if we miss any part of it then it will show up as a bright area in the finished picture (the dramatic clouds are very dark). Therefore it would be a good idea to make our selection 'grow' slightly to make sure we have not missed any sky pixels. Choose Select>Grow and make the selected area grow by just 1 pixel - you will hardly notice the difference.

Now delete the selected area with Edit>Clear or Ctrl+K (K for kill?)? You should see a checkerboard pattern which indicates that that part of the image is transparent.

Now we just need to insert the clouds image into a new layer under the existing picture.

Right-click HERE to download a photo of dramatic clouds (photographed from Mougins, France, then adjusted to have increased contrast). Then open the clouds image in a separate Gimp window, copy the image with Ctrl+C and then paste it (Ctrl+V) into the horse image. You will think you have lost the horse image, but looking at the layers dialog, you should see that the clouds have been put into a new layer called 'floating selection' which is on top of the horse layer, obscuring it. Whenever you paste an image with Ctrl+V you should then convert the floating selection layer into a normal layer by clicking the new layer button in the layer dialog. Alternatively, you can combine the 'paste as floating selection' and 'convert floating selection to layer' steps into a single step by just choosing Edit>Paste As>New Layer.

Now you simply have to drag the horse layer on top of the clouds layer in the layers dialog and the picture should be just about finished. The clouds image is bigger than the horse image so you can choose which part of the clouds you want to use by moving the clouds layer with the move tool - make sure the clouds layer is active (dark blue) in the layers dialog when you do this.

Your finished image should look something like this (but bigger!):

Want a different effect? Try inverting the colors of the clouds - make sure the clouds layer is active and then do Colors>Invert.

You have begun working with layers in this lesson and you should sense their power. You will work with them much more in future lessons. As you work more and more with lessons how important it is to be aware which layer is the active layer - often you will try to apply effect and will no result or an unexpected result because the wrong layer is active...