4. Layer Groups
| 第 8 章 合并图像 |

## 4. Layer Groups

This possibility appeared with GIMP-2.8.

You can group layers that have similarities in a tree-like way. So, the layer list becomes easier to manage.

Create a Layer Group

  You can create a layer group by clicking on the Create a new layer group button at the bottom of the layer dialog,

  through Layer → New Layer Group, or through the layer dialog context menu.

  This empty layer group appears just above the current layer. It is important to give it an evocative name (double-click or F2 on the name, or use Edit Layer Attributes in the context menu you get by right clicking the Layer dialog, to edit it), else you will get confused when several ones are created.

  You can create several layer groups and you can embbed them, that is include a layer group in another one.

Adding Layers to a Layer Group

  You can add existing layers to a layer group by click-and-dragging them.

  | 注意
  The hand representing the mouse pointer must turn smaller before releasing the mouse button. A thin horizontal line marks where the layer will be laid down.

  To add a new layer to the current layer group, click on the Create a new layer at the bottom of the layer dialog, or use the New Layer command in the image menu.

  When a layer group is not empty, a small “>” icon appears. By clicking on it, you can fold/unfold the layer list.

  You can put layers to be added together to a layer group by making them, them only, visible, and using the “New From Visible ” command. All visible layers, outside and inside layer groups, will be added to the active layer group.

  Layers that belong to a layer group are slightly indented to the right, allowing you know easily which layers are part of the group.

Raise and Lower Layer Groups

  You can raise and lower layer groups in the layer dialog as you do with normal layers: click-and-dragging, using arrow up and down keys at the bottom of the layer dialog.

Duplicate a Layer Group

  You can duplicate a layer group: click on the Create a duplicate of the layer button or right-click and select the Duplicate Layer command in the pop up context menu.

Move Layer Groups

  You can move a layer group to another image by click-and-dragging. You can also copy-paste it using Ctrl-C and Ctrl-V: then, you get a floating selection that you must anchor (anchor button at the bottom of the layer dialog).

  You can also move a layer group to the canvas: this duplicates the group in the group. Chain all layers in the duplicated layer group, activate the Move tool, then, in the image, move the layer. That's a way to multiply multi-layer objects in an image.

Delete a Layer Group

  To delete a layer group, click on the red cross button at the bottom of the layer dialog or right-click and select Delete layer.

Embed Layer Groups

  When a layer group is activated, you can add another group inside it with the “Add New Layer Group” command. There seems to be no limit, excepted memory, to the number of embedded layer groups.

Layer Modes and Groups

  A layer mode applied to a layer group acts on layers that are in this group only. A layer mode above a layer group acts on all layers underneath, outside and inside the layer groups.

  Original image

  图 8.33. Layer Mode in or out Layer Group

  We added a white layer in the layer group with saturation mode: only square and triangle are grayed out.

  We added a white layer out of the layer group with saturation mode: all layers underneath are grayed out, background layer also.

Opacity

  When a layer group is activated, opacity changes are applied to all the layers of the group.

Layer Mask

  You cannot add a layer mask to a layer group (the corresponding option is grayed out). But, as with normal layers, you can add a layer mask to a layer in the group to mask a part of the layer.

  We added a white (Full opacity) layer mask to the triangle layer.

3. Creating New Layers |  | 第 9 章 Text Management

Report an error in Bugzilla