[LinuxFocus-icon]
Home  |  Map  |  Index  |  Search

News | Archives | Links | About LF
This document is available in: English  Castellano  Deutsch  Francais  Nederlands  Portugues  Turkce  Arabic  

convert to palmConvert to GutenPalm
or to PalmDoc

[Yves Ceccone]
by Yves Ceccone (homepage)

About the author:
Photographer, converted to desktop publishing. He's never let go of a mouse ever since.

Translated to English by:
NLandu Mbela <cnmn(at)hoga.pl>

Content:

 

Gimp: using mask layers

[Illustration]

Abstract:

Gimp can easily compete with the big names in picture editing. It has a tool, mask layers ( similar to the fusion mask in Photoshop) which allows you to work on layers with great ease. With this method it is quite easy to go back and correct a corner without touching the layer itself since we're working on a mask which we can delete if the changes don't please us or apply if they are satisfying. Mask layers can also allow you to create merge effects, volume effects ...,it is much easier to understand how it works than trying to list all of its possibilities.



 

Version

Gimp version 1.1.9 was used for this article, but layer masks are also present in older versions, e.g 1.0.4 but I would advise you to use a more recent version, e.g 1.2.1. There are many new tools and possibilities, this will make some of the exercises in this article much simpler. It is very easy, and Gimp will speak your language, since new international versions have been made.  

Transforming a background into a layer

Open Gimp and create an RGB image with a white background. Fill it with any pattern

[white] [pattern] [erase pattern] [transparent, alpha channel]

Press on "D" once to make the foreground color black and the background color white. Choose the eraser tool to erase and move it on top of the pattern, while erasing the pattern we can see the white background appear.
Press ctrl+Z to go back to the pattern.
Now open the "Layer" panel and choose the option "Add alpha channel" by clicking the right mouse button while on the background. Now try using the eraser like before. Instead of a white background, the pattern representing transparency appears.
We have transformed a background into a layer by adding an alpha channel.
Advantages of layer: Transparency, position change in relation to others, ...mask layer.  

Principles

[pattern1] [pattern2]

Create an image with a pattern. Transform its background into a layer by adding an alpha channel. Rename the background "layer 1" by double clicking on it. Add a new layer ( you can click on the bottom left icon in the "Layers, Channels and Paths" panel or by clicking the right mouse button in this panel and choosing "New Layer" ). Choose "transparent" and name it "layer 2".
We can see layer 1 through layer 2 which is transparent. Choose layer 2 in the panel and fill it with a pattern different from the one in layer 1. We can only see the pattern of the top layer now, which is that of layer 2. Of course, we can toggle between layers by clicking the appropriate eye icon in the layer panel.

[Layers and channels]

Choose layer 2 and add a mask layer unto it with full opacity (choose white). It is now possible to work either on the layer or its mask. To work on the mask just click once on thumbnail of the mask to choose it (once you choose the mask or the layer its stencil turns white).

[Layers and channels] [the resulting image]

Click on "D" once to put black in the foreground and use the pencil tool, choose a round brush for example. Then draw on the image. We can clearly see in the screen representation that we have masked parts of the layer with the pencil tool in black, and we see parts of the pattern in the layer instead. Click on "X" to switch between the white and the black color and draw (in white this time) on the layer:
we recover the layer 2. We can clearly see with what ease we can work, undo, change tools if needed with the "X" key without touching the layer because we're working on its mask.


Commands :
All the tools can be used as we work on the mask layer: fades, filters, airbursh, selections, ..., many possibilities in view.  

Transition effect

[layer and channels]

[pattern] [black->white fade] [result]

This effect was accomplished by filling the mask layer with a black->white fade.  

Corner

[ball]

[new background] [final image]

The advantage of this corner effect is the possibility of undoing something (with the "X" key), the possibility to not touch the layer, and the possibility to corner an object with borders of different sharpness by selecting the appropriate hardness of our tool.  

Blur mask

[layer and channels]

[mask layer] [background]
[G written in black] [blured G]

On the fourth image a blur filter was applied on the mask layer.  

Volume effect

Volume effect can be created in Gimp by using the mask layers and some tricks.

[circular selection]
[layer, channel and path window]

Create a square image. Make a circular selection ( for this purpose you can use shift and ctrl at the same time) to have a perfect circle and start from its center. Save the drawn line by right clicking on the channel ->selection->save in channel (this will allow us to call the selection back. It will serve as the base of all drawn lines that will follow). Fill this circle with the pattern (it has one of those that come complete with Gimp or an equivalent) used for screen capture. For this the selection has to be active, choose the pattern, double click on the bucket of paint and choose "fill with pattern", and then click on the selection. Create a layer mask (white) and after having chosen the default option of fade (black->white) in the dialog box, with the fade tool, draw a line starting from the lower-left end angle to the upper-right end angle (45 degrees).
You can repeat this operation as many times as you want to get the right feeling (change the start and end position of the line). Anyway, we can always come back to these settings when we want. Note that a fade can be applied to the mask with or without any active selection. The selection was active for the layer mask 1, not for 2, no change in the results.

[3d border] [layer, channel and path window]

Recall the saved selection in a channel. Go to the tab of channels in Channel and layer panel and click on the option for copying the selection layer, the option whose icon should be a white circle on a black square and click on the icon representing a dotted circle. The selection should appear (for version 1.04 you can do "Channel to selection").
The next maneuver will create a sort of a hoop around the first center: (with version 1.04 we can choose selection->border, less precise for this exercise). The selection being active do right-click -> selection -> zoom and choose (do some tests) a value that will create a strip around the first center like in the first screen capture. Save this selection in a channel (selection -> save in channel). Activate (if it is not active yet) the biggest circular selection, and click on first selection's channel icon in the tab for channels (the smallest) that you saved in the previous phase (don't click in the eye column). Go to the dotted circle icon (but without clicking), then click. We have subtracted the small selection from the big one with this operation. We can eventually save this new selection in a channel.
Create a new layer. Fill this selection (on the new layer) with the same pattern, create a mask layer and apply a fade to it in the opposite direction then the previous one (from top to bottom with the fade tool).

Use Gimp's native format, which stores masks, to save your work.
[3d border] [layer, channel and path]

We will proceed the same way as before to add a very thin exterior circular strip. To obtain a rather remarkable difference then in the one before, we will have to play with the placement of the fade and the density and contrast of two elements (Picture -> Color -> Brightness -> Contrast...).
[3d border] [layer, channel and path]

The last element is a strip placed inside the first circle, filled with a uniform gray thanks to which we will apply a blur filter. And, of course, a layer mask with a light fade to brighten up the lower right part. Here we are, the making of the flat effect is done. It has nothing to do with 3D, but a certain volume feeling...
 

Script-Fu

It is quite interesting to analyze the images created with Gimp's Script-Fu, they often use mask layers and we learn much opening up the layer panel to find out how it was constructed.
[script-fu logo] [layer, channel and path]

This Script-Fu is found in Xtns -> Script-Fu ->Logos -> Chrome and it is done with a true type font called "stoopid", and uses a mask layer... We have to modify the color of the G layer to be able to use it in our image we created: with "Picture -> Color -> color balance", for example or "levels", and then reduce the shadow density to 50% (with the opacity cursor of the layer leaf). Then delete the background layer and while in the layer leaf do: "right-click"-> join visible layers. Then do ctrl + c to copy the logo, ...

[button with G from script-fu] [layer, channel and path]

...for the placing on the flat image do ctrl + v to copy it. A floating selection appears in the layer panel, you have to create a new layer where to place the logo, which we'll be able to rework on color, size, position....  

Ribbon

Another use of mask layers: The strip that wraps itself around an object...
[object] [blue line] [object wrapped with a blue ribbon]

A background is needed for the layer, an object surrounding another, and at least a ribbon on a third. We can use a line drawn with a brush or an airbrush, use a blur filter, and play with the layer's density, its color, another filter...

[layer, channel and path window]

The principle is the same, you need a mask on each layer with a ribbon, and then hide the parts which are supposed to be behind the object...  

Endless

A few ways you can use the mask have been described, but the possibilities are endless so give way to your imagination...  

Talkback form for this article

Every article has its own talkback page. On this page you can submit a comment or look at comments from other readers:
 talkback page 

Webpages maintained by the LinuxFocus Editor team
© Yves Ceccone, FDL
LinuxFocus.org

Click here to report a fault or send a comment to LinuxFocus
Translation information:
fr --> -- : Yves Ceccone (homepage)
fr --> en: NLandu Mbela <cnmn(at)hoga.pl>

2001-12-27, generated by lfparser version 2.23