Kapitel 8. Kombinera bilder

Innehållsförteckning

1. Introduktion till lager
1.1. Lageregenskaper
2. Lagerlägen
3. Opret nye lag
4. Layer Groups

1. Introduktion till lager

You can think of layers as a stack of slides. Using layers, you can construct an image of several conceptual parts, each of which can be manipulated without affecting any other part of the image. Layers are stacked on top of each other. The bottom layer is the background of the image, and the components in the foreground of the image come above it.

Figur 8.1. An image with layers

An image with layers

Layers of the image

An image with layers

Resulting image


There is no limit, in principle, to the number of layers an image can have: only the amount of memory available on the system. It is not uncommon for advanced users to work with images containing dozens of layers. You can group layers to make your work easier, and you have many commands to handle layers.

The organization of layers in an image is shown by the Layers dialog, which is the second most important type of dialog window in GIMP, after the Main Toolbox. The appearance of the Layers dialog is shown in the adjoining illustration. How it works is described in detail in the Layers Dialog section, but we will touch on some aspects of it here, in relation to the layer properties that they display.

Each open image has at any time a single active drawable. A drawable is a GIMP concept that includes layers, but also several other types of things, such as channels, layer masks, and the selection mask. (Basically, a drawable is anything that can be drawn on with painting tools). If a layer is currently active, it is shown highlighted in the Layers dialog, and its name is shown in the status area of the image window. If not, you can activate it by clicking on it. If none of the layers are highlighted, it means the active drawable is something other than a layer.

In the menu bar above an image window, you can find a menu called Layer, containing a number of commands that affect the active layer of the image. The same menu can be accessed by right-clicking in the Layers dialog.

1.1. Lageregenskaper

Varj lager i en bild har ett antal viktiga attribut:

Namn

Varje lager har ett namn. Det tilldelas automatiskt när ett lager skapas men du kan ändra det. Du kan ändra namnet på lagret antingen genom att dubbelklicka på det i lagerdialogen eller genom att högerklicka där och välja det översta alternativet i menyn som visas; Redigera lagerattribut.

Närvaro eller frånvaro av alfakanal

En alfakanal kodar information om hur transparent ett lager är för varje pixel. Detta är synligt i kanaldialogen: Vitt är helt opakt, och svart är helt genomskinligt och grånivåerna är delvis genomskinliga.

The background layer is particular. If you have just created a new image, it has still only one layer which is a background layer. If the image has been created with an opaque Fill type, this one layer has no Alpha channel. To get a background layer with transparency, either you create your new image with a transparent Fill type, or you use the Add an Alpha Channel.

If you add a new layer, even with an opaque Fill type, an Alpha channel is automatically added to the layer.

Varje annat lager än det nedersta lagret i en bild har per automatik en alfakanal, men du kan inte en gråskalerepresentation av alfavärden. Se Alpha i ordboken för mer information.

Exempel för alfakanal. 

Figur 8.2. Alfakanal exempel: Enkel bild

Alfakanal exempel: Enkel bild

Den här bilden har tre lager målat med ren 100% opakt rött, grönt och blått. I kanaldialogen kan du se att en alfakanal lagts till. Denna är vit för bilden inte transparent då det finns åtminstone ett lager som är 100% opakt. Det aktuella lager är det röda: det det är måla helt röd, finns där inget grönt och inget blått och de korrensponderande kanalerna är svarta.


Figur 8.3. Alfakanal exempel: Ett transparent lager

Alfakanal exempel: Ett transparent lager

Den vänstra delen av det första lagret har gjorts tranparent (rektangelmarkering, redigera/töm). Det andra lagret, grönt, är synligt. Alfakanalen är fortfarande vit då det finns ett opakt lager i denna delen av bilden.


Figur 8.4. Alfakanal exampel: Två transparenta lager

Alfakanal exampel: Två transparenta lager

Den vänstra delen av det andra lagret har gjorts transparent. Det tredje lagret, blått är synligt genom det första och andra lagret. Alfakanalen är fortfarande vit eftersom det finns ett opakt lager i denna delen av bilden.


Figur 8.5. Alfakanal exampel: Tre transparenta lager

Alfakanal exampel: Tre transparenta lager

The left part of the third layer has been made transparent. The Alpha channel is still white and the left part of the layer is opaque. The background layer has no Alpha channel. In this case, the Clear command works like the Eraser and uses the Background color of Toolbox.


Figur 8.6. Alpha channel example: Alpha channel added to the Background

Alpha channel example: Alpha channel added to the Background

We used the LayerTransparencyAdd Alpha Channel command, on the Background layer. Now, the left part of the image is fully transparent and has the color of the page the image is lying on. The left part of the Alpha Channel thumbnail is black (transparent) in the Channel Dialog.


Lagertyp

Lagertypen bestäms av bildtypen (se föregående avsnitt) och närvaron eller frånvaro av alfakanal. Dessa är de möjliga lagertyperna:

  • RGB

  • RGBA

  • Grå

  • GråA

  • Indexerad

  • IndexeradA

Huvudorsaken till att detta avgör är att de flesta filter (in the Filters accepterar enbart en underuppsättning av lagertyper och visas gråad i menyn om det aktiva lagret inte är en godkänd typ. Du kan oftast rätta till detta genom att antingen ändra bildläge eller genom lägga till eller ta bort en alfakanal.

Visibility

It is possible to remove a layer from an image, without destroying it, by clicking on the symbol in the Layers dialog. This is called toggling the visibility of the layer. Most operations on an image treat toggled-off layers as if they did not exist. When you work with images containing many layers, with varying opacity, you often can get a better picture of the contents of the layer you want to work on by hiding some of the other layers.

[Tips] Tips

Om du Shift-klickar ögonsymbolen kommer det att göra att alla lager, utom den du klickar på, gömmas.

Active layer

Usually, you activate a layer, to work on it, clicking it in the layer list. When you have a lot of layers, finding which layer an element of the image belongs to is not easy: then, press Alt and click with Mouse wheel on this element to activate its layer. The available layers will be looped through (starting from the upper one) while the Alt is held and the picked layer will be temporarily displayed in the status bar.

Linkage to other layers

Om du klickar mellan ögonikonen och lagret miniatyrbild får du fram en länkikon som som låter dig att gruppera lager för operationer på flera ( t ex med flyttverktyget eller transformationsverktyget).

Figur 8.7. Lagerdialog

Lagerdialog

Red: Linkage to others layers. Green: Visibility.


Storlek och gränser

In GIMP, the boundaries of a layer do not necessarily match the boundaries of the image that contains it. When you create text, for example, each text item goes into its own separate layer, and the layer is precisely sized to contain the text and nothing more. Also, when you create a new layer using cut-and-paste, the new layer is sized just large enough to contain the pasted item. In the image window, the boundaries of the currently active layer are shown outlined with a black-and-yellow dashed line.

Varför detta spelar roll är att du inte kan göra något utanför ett lagers gränser: du kan inte agera i vad som ej existerar. Om det skapar problem för dig, kan du ändra dimensionerna för lager genom att använda.

[Notera] Notera

Den mängd minne som ett lager förbrukar är bestämt av dess storlek inte av dess innehåll. Så om jobbar med stora bilder eller bilder som innehåller många lager kan det löna att dra ner lagren till minsta möjliga storlek.

Opacitet

Opaciteten i ett lager avgör i vilken den låter färger från lager under i högen synas. Opacitet sträcker sig från 0 till 100, där 0 betyder helt transparent och 100 betyder helt opakt.

Läge

Läget på lagret bestämmer hur färger från lagret kombineras med färgerna från de underliggande lagren för få fram ett synligt resultat. Detta hyfsat komplext och hyfsat viktigt koncept som förtjänar ett eget avsnitt som följer. Se Avsnitt 2, ”Lagerlägen”.

Lagermask

Förutom alfakanalen finns det ett annat sätt att kontroller transparens i ett lager: genom att lägga på en lagermask som är en en extra gråskalad ritbarhet associerad med lagret. Ett har ingen mask som standard: det måste läggas till för sig. Lagermasker, och hur man jobbar med dem, beskrivs mer utförligt i Lagermask avsnittet.