# 8. Layers

For some types of painting and image manipulation it is convenient to use multiple layers of images rather than a single image. For example you may want to overlay text or drawings over a photograph and then be able to move or edit each layer independently.

## 8.1 Creating

To start using layers with mtPaint you must first load the image you want to be the background. This is the most important step as all the other layers sit on top of this image (also, the size of the background image determines the size of the final composite image). Next you must create a new layer by using the Layers window ('L' key or View menu). You can then edit, manipulate, load to, or save this new layer just like any other image. The only difference is that this image can have a transparent colour which will show the pixels used on the background image (or lower layers if there are any).

### 8.1.1 Drag 'n' Drop

If you have several images that you want to open as layers, it is possible to do this using a file manager and its drag 'n' drop facility. Simply select all of the image files you want using your favourite file manager (e.g. Rox, Konqueror, Nautilus), and then drag them over the main mtPaint window and release the mouse button. mtPaint will then load each of the files as a new layer.

## 8.2 Manipulating

You can move any layer around by clicking and dragging it in the the view window, or by pressing CTRL and using the arrow keys (+SHIFT nudges like pasting). There is also a button on the layers window which puts the layer back to the centre of the background image. The layers window allows you to name each layer for convenience and to temporarily hide it by unchecking the toggle button to the right of the layers name.

When you decide you want to save this composite image you use the layers menu. If you want to save information relating to the layers you will need to use the option 'Layers->Save As' which saves a small text file containing information about each layer.

You can then load these layers back into mtPaint by loading the text file. Please note that when you save the composite image or the text file you are not saving each individual layer. As mentioned earlier, each layer is considered to be its own file and must be saved with the 'File' menu or Ctrl-S as normal. The benefit of treating the layers separately is as follows:

- Less disk space is required as the layers are not clumped together into a new file.
- Image layers can be edited with any other image editor.
- If you are using a standard image for several composite images (e.g. a standard logo or piece of text for watermarking photos), you only need to edit one image and all of the other composite images will be updated automatically the next time you save them.

  After saving the layers text file you must not move it anywhere else unless you also move the image files with it as these file references are relative. The simplest method is to keep all original images and text files in a single directory.

  When using layers, the undo memory limit set in the preferences window must be divided by the number of layers to determine the limit per layer. For example, with a 32MB limit and 4 layers there is an 8MB limit per layer for the undo.

  ## 8.3 Examples

  Here are some examples of composite images created by using the layer facilities. Click on each image to download the source files:

  ## 8.4 Tricks and Tips

  ### 8.4.1 Creating a Scrapbook using Layers

  - Create a new background image which is large enough to hold all of your images
  - Select a bunch of image files (e.g. photos or clip art) using your favourite file manager, and then drag and drop them onto the main mtPaint window to load them in as new layers
  - Position the images in the view window so they are all visible and sit on the background image
  - Create new layers in order to hold individual items of text
  - Save the layers file so you can edit the layers at a later date, and then save the composite image file so you can distribute it as a standard PNG/JPEG image

  ### 8.4.2 Gradient Stencils

  If you combine the layers feature with gradients and alpha channels, you can create some useful stencil based images. For example you can do things like this:

  If you click on the above image you can download a zip file containing the various layer images which you can then study to see how they were created and how they merge together to create the final composite image.

  Each object has its own layer so it can be moved independently of the other objects. Also, you can re-use any of the layers in any other project using any image editor because they are just RGBA PNG files.

  The text objects use a linear gradient (or flat black for the shadow) as the RGB image channel. The text stencil is created by using an alpha channel and pasting some text onto it.