2. Image Structure Related Dialogs

The following dialogs let you control and manipulate image structures, such as layers, channels, or paths.

2.1. Layers Dialog

شكل 15.1. Layers Dialog

Layers Dialog

The Layers dialog is the main interface to edit, modify and manage your layers.

2.1.1. Activating the dialog

The Layers dialog is a dockable dialog; see the section قسمت 2.3, “Dialogs and Docking” for help on manipulating it.

You can access it:

  • from the image menu: WindowsDockable DialogsLayers;

  • from the Tab menu in any dockable dialog by clicking on and selecting Add TabLayers,

  • from the (default) shortcut: Ctrl+L.

In the Windows menu, there is a list of detached windows which exists only if at least one dialog remains open. In this case, you can raise the Layers dialog from the image-menu: WindowsLayers.

2.1.2. Using the Layer dialog

Overview

Every layer appears in the dialog in the form of a thumbnail. When an image has multiple layers as components, they appear as a list. The upper layer in the list is the first one visible, and the lowest layer the last visible, the background. Above the list one can find characteristics related individually to each layer. Under the list one can find management buttons for the layer list. A right-click in a layer thumbnail opens the Layer context menu.

Layer attributes

Every layer is shown in the list along with its attributes:

Layer visibility

In front of the thumbnail is an icon showing an eye. By clicking on the eye, you toggle whether the layer is visible or not. (Shift-clicking on the eye causes all other to be hidden.)

Chain layers

Another icon, showing a chain, allows you to group layers for operations on more than one layer at a time (for example with the Move tool).

Layer thumbnail

The layer content is represented in a thumbnail. Maintaining left-click for a second on this thumbnail makes it larger. When the layer is active, the thumbnail has a white border. The border is black if the layer is inactive. When the layer has a mask, the inactive element takes a black border.

Layer name

The main attribute is the name of the layer. You can edit this by a double-click on the name of the layer. You can also use the Edit Layer Attributes dialog you can find in the context menu that you get by through a right-click on the layer.

[ياداشت] ياداشت

In the case of an animation layer (GIF or MNG), the name of the layer can be used to specify certain parameters : Layer_name (delay in ms) (combination mode), for example Frame-1 (100 ms) (replace). The delay sets the time during which the layer is visible in the animation. The combination mode sets whether you combine the layer with the previous layer or replace it: the two modes are (combine) or (replace).

Layers characteristics

Above the layer list, it is possible to specify some properties for the active layer. The active layer is the one highlighted in blue. The properties are: Layer mode, Opacity, Lock pixels and Lock Alpha channel.

Mode

The layer mode determines how the layer interacts with the other layers. From the combo box you can access all the modes provided by GIMP. The layer modes are fully detailed in قسمت 2, “Layer Modes” .

Opacity

By moving the slider you give more or less opacity to the layer. With a 0 opacity value, the layer is transparent and completely invisible. Don't confuse this with a Layer Mask, which sets the transparency pixel by pixel.

Lock

You have three possibilities:

  • Lock pixels: When the button is pressed down, you cannot use any brush-based tool (Paintbrush, Pencil, Eraser etc.), the Airbrush or the Ink tool on the currently selected layer. This may be necessary to protect them from unwanted changes.

    شكل 15.2. Lock pixels

    Lock pixels

  • Lock position and size: This toggle button enables and disables protection of layers from moving them around or transforming them. When the button is pressed down, you cannot use any transform tool (Rotate, Shear, Perspective and others) or move it.

    شكل 15.3. Lock position and size

    Lock position and size

  • Lock alpha channel: This toggle button controls the Lock setting for the transparency of the layer . If this is pressed down, then the alpha channel for the layer is locked, and no manipulation has any effect on it. In particular, nothing that you do to a transparent part of the layer will have any effect.

    شكل 15.4. Lock Alpha channel

    Lock Alpha channel

شكل 15.5. Example for Locking Alpha Channel

Example for Locking Alpha Channel

The active layer has three horizontal, opaque, green stripes on a transparent background. We paint a vertical red stripe. Lock unchecked: Opaque and transparent areas of the active layer are painted with red.

Example for Locking Alpha Channel

Lock checked: Only opaque areas of the active layer are painted with red. Transparent areas are preserved.


[نکته] نکته

If a layer name in the Layer Dialog is in bold, then this layer has no Alpha channel.

Layer management

Under the layer list a set of buttons allows you to perform some basic operations on the layer list.

New Layer

Here you can create a new layer. A dialog is opened, which is described in New Layer.

Press the Shift key to open a new layer with last used values.

New Layer Group

Here you can create a new layer group. A new layer is created, where you can put layers down.

Layer groups are described in Layer groups.

Raise layer

Here you can move the layer up a level in the list. Press the Shift key to move the layer to the top of the list.

Lower layer

Here you can move the layer down a level in the list. Press the Shift key to move the layer to the bottom of the list.

[نکته] نکته

To move a layer at the bottom of the list, it may first be necessary to add a transparency channel (also called Alpha channel) to the Background layer. To do this, right click on the Background layer and select Add Alpha channel from the menu.

Duplicate layer

Here you can create a copy of the active layer. Name of new layer is suffixed with a number.

Merge layers Anchor layer

Before GIMP-2.10.18, this button was permanently for anchoring. Now, it becomes an anchor only when a floating selection is created (it anchors the floating selection to the previous active layer). Else, it is a Merge layers icon with several possibilities:

  • Merge this layer with the first visible layer below it.

  • Pressing Shift: merge the layer group's layers into one normal layer.

  • Pressing Ctrl: merge all visible layers into one normal layer.

  • Pressing Shift+Ctrl: merge all visible layers with last used values.

Delete layer

Here you can delete the active layer.

More layer functions

Other functions about layer size are available in the Layer context menu you get by right clicking on the Layer Dialog. You can find them also in the Layer sub-menu of the image menu.

You will find merging layers functions in the Image menu.

Clicking-and-dragging layers

Click and hold on layer thumbnail: it enlarges and you can move it by dragging the mouse.

  • So you can put this layer down somewhere else in the layer list.

  • You can also put the layer down into Toolbox: a new image is created that contains this layer only.

  • Finally, you can put the layer down into another image: this layer will be added to the layer list, above existing layers.

2.1.3. The Layer dialog context menu

شكل 15.6. Context Menu for the Layers Dialog

Context Menu for the Layers Dialog

By right-clicking in the layer dialog, or by opening the Layers Menu from the tab menu, a context menu for the Layers dialog will open.

Most of the commands in this menu have already been documented above, or elsewhere:

Edit Layer Attributes...

Except for Width, Height, and Fill with, this dialog is the same as the New Layer Dialog. For information about the layer attributes we therefore refer to the documentation for that dialog.

Blend Space submenu

See Blend space in the New Layer dialog.

Composite Space submenu

See Composite space in the New Layer dialog.

Composite Mode submenu

See Composite mode in the New Layer dialog.

Color Tag submenu

See the Color tag documentation in the New Layer dialog.

New Layer, New Layer Group, Duplicate Layer, Merge Down, Anchor Layer, Delete Layer

These commands are explained above, see layer characteristics.

New from Visible

See the New from Visible menu command documentation.

Layer Boundary Size...

See the Layer Boundary Size... menu command documentation.

Layer to Image Size

See the Layer to Image Size menu command documentation.

Scale Layer...

See the Scale Layer... menu command documentation.

Add Layer Mask..., Apply Layer Mask, Delete Layer Mask, Show Layer Mask, Edit Layer Mask, Disable Layer Mask, Mask to Selection

See the Layer Mask submenu documentation for these commands.

Add Alpha Channel, Remove Alpha Channel

Only one of these will be enabled. If the current layer does not have an alpha channel, you will be able to add one. If it does, you can remove the alpha channel.

Merge Visible Layers

This command merges all visible layers into one layer.

Flatten Image

This command merges all layers into one layer and removes transparency.

2.1.4. Layer masks

شكل 15.7. Add mask dialog

“Add mask” dialog

Overview

A transparency mask can be added to each layer, it's called Layer mask. A layer mask has the same size and same number of pixels as the layer to which it is attached. Every pixel of the mask can then be coupled with a pixel at the same location in the layer. The mask is a set of pixels in gray-tone on a value scale from 0 to 255. The pixels with a value 0 are black and give a full transparency to the coupled pixel in the layer. The pixels with a value 255 are white and give a full opacity to the coupled pixel in the layer.

To create a layer mask start with a right click on the layer to call the context menu and select Add layer mask in the menu. A dialog appears where you can initialize the content of the mask:

  • White (full opacity): the mask is white in the Layer Dialog. So, all pixels of the layer are visible in the image window since painting the mask with white makes layer pixels fully visible. You will paint with black to make layer pixels transparent.

  • Black (full transparency): the mask is black in the Layer Dialog. So, the layer is fully transparent since painting the mask with black makes layer pixels transparent. Painting with white will remove the mask and make layer pixels visible.

  • Layer's alpha channel: the mask is initialized according to the content of layer Alpha channel. If the layer still contains transparency it's copied in the mask.

  • Transfer layer's alpha channel: Does the same thing as the previous option, except that it also resets the layer's alpha channel to full opacity.

  • Selection : the mask is initialized according to pixel values found in the selection.

  • Grayscale copy of layer: the mask is initialized according to pixel values of the layer.

  • Channel: The layer mask is initialized with a selection mask you have created before, stored in the Channel dialog.

  • Invert mask : This checkbox allows you to invert : black turns to white and white turns to black.

When the mask is created it appears as a thumbnail right to the layer thumbnail. By clicking alternatively on the layer and mask thumbnail you can enable one or other. The active item has a white border (which is not well visible around a white mask). That's an important point. Always keep the Layers Dialog prominently when working with masks, because you can't see, looking at the canvas, which of the layer or the mask is active.

Pressing Alt (or Ctrl+Alt and click on the layer mask thumbnail) is equivalent to the Show Layer Mask command : the layer mask border turns to green. If you press Ctrl the border is red and the result is equivalent to the Disable Layer Mask command. To return to normal view redo last operation. These options are for greater convenience in your work.

Layer Mask example

شكل 15.8. A layer with layer mask

A layer with layer mask

This image has a background layer with a flower and another blue one, fully opaque. A white layer mask has been added to the blue layer. In the image window, the blue layer remains visible because a white mask makes layer pixels visible.


شكل 15.9. Painting the layer mask

Painting the layer mask

The layer mask is active. You paint with black color, which makes the layer transparent: the underlying layer becomes visible.