Next up in this GIMP Layers series, I’ll be covering the topic of layer groups. This feature is as much of a way to keep your layers organized in GIMP as it is a way of being able to add awesome effects to multiple layers.
Creating a Layer Group
For starters, layer groups can contain just a single layer or multiple layers. To create a new layer group, you first must have a composition open in GIMP.
For this example, I am going to open a photo of a girl standing in a field of sunflowers. I’ll go to the file folder where this image is located on my computer, and will click and drag the image into GIMP to open it as a new composition (follow the green line in between the red arrows in the photo above).
If you look over in the Layers panel, you’ll see that I have a single layer – the name of which is based on the original name of the file. I can, of course, double click on the layer name (red arrow) to change it to something simpler. In this case, I went with “Sunflowers.” Hit enter to apply the name.
Now that I have a composition open in GIMP I can create a layer group. Note that my composition doesn’t have to be a photo – it can also simply be a new blank layer. To create a new layer group, click the “Create a new layer group” icon at the bottom of the Layers panel (green arrow in the photo above).
After clicking this icon, a new layer group folder will appear inside the layers panel called “Layer Group” above my active layer (since there is only one layer in this composition, the layer group folder will appear at the top of the Layers panel in this example).
Much like a standard layer in GIMP, I can rename my layer group folder by double-clicking on the name and typing a new name (red arrow). Since I will be importing some additional photos for this tutorial, all of which consist of models posing out in nature, I will name the layer group “Nature Photos.” When I have the layer group selected, it will have a blue dotted outline around it rather than the standard yellow dotted outline that goes around a layer.
Adding Layers to Your Layer Group
Once you have a layer group folder, you can click and drag any of your layers into this folder. For example, I’ll click and drag my Sunflowers photo (red arrow) into the layer group by hovering my layer over the layer group folder until it has a dotted line around it (green arrow).
Then, when I release my mouse, you’ll see that my Sunflowers layer is now inside of the layer group folder because it is indented to the right (denoted by the red arrow in the photo above). Additionally, my layer group folder now has a “-” (minus sign) to the left of the thumbnail (green arrow). This minus sign allows me to expand or collapse the items in my layer group by simply clicking it.
When the layer group is collapsed, the minus sign will change to a “+” (plus sign – denoted by the red arrow) – informing me that I can expand the layer group to reveal a layer or layers inside. I will click the plus sign to once again reveal the Sunflowers layer inside the layer group.
One last observation you may have made at this point is that the layer group thumbnail (outlined in green in the photo above) is no longer a folder icon. Instead, it has changed to the image inside the layer group. Your layer group thumbnail will always display the visible final result of all of your layers being combined in your layer group. In this case, since there is only a single layer, the final result is simply our Sunflowers photo.
It’s a bit difficult to understand the true purpose and benefits of a layer group when there is only a single layer in it. This being said, I will now bring some more photos into our composition to show off what layer groups can do.
To do this, I’ll navigate back over to my file folder on my computer (using the File Explorer on Windows, or the Finder Window on a MAC) that contains the additional images I would like to add to my composition. In my case, I want to bring in two additional images (one of a girl in a grass field and one of a hiker) – so I’ll select these two images in my File Explorer (outlined in green in the photo above) and will once again click and drag them into GIMP (following the green dotted line to the red arrow). By dragging and dropping them directly on my open GIMP composition, they will open as two new layers within this composition.
You may recall from my previous GIMP Layers article that new layers are always added above whatever your active layer is. In this case, since our active layer was inside a layer group, our two new layers that we dragged and dropped into GIMP were added inside the layer group (outlined in green in the image above). This works out in this case because I want these two images in the layer group. However, there may be situations where you do not want your new layers added to your layer group.
Moving and Hiding Layers in Layer Groups
If this is the case, you can always click and drag your image layers outside of the layer group. You will know that you are dragging the image outside the layer group because a line will appear in the location where you are dragging your image (denoted by the red arrow in the image above). If the line is the full length of the layer group thumbnail and layer group name, then your image will be moved outside of the layer group.
If, on the other hand, the line is only the length of the layer thumbnail and layer name inside the layer group (denoted by the red arrow), then that means the layer you are moving will still be located inside that layer group. In the above image, I dragged the layer back into the layer group from outside the layer group.
We now have three layers inside the layer group. In my case, the top layer is the “Hiker” layer (which I will double click on and rename to “Hiker” to make this tutorial easier to follow), the middle layer is a photo of a girl in a grass field (I’ll double click on the layer name and rename this layer “Field”), and the bottom layer is our original “Sunflowers” layer.
When looking on the canvas, you’ll notice that the three photos are all different sizes. The Hiker photo is the smallest, and thus only obstructs parts of the two layers below. The Field layer is a little larger, so you can see parts of it sticking out behind the Hiker photo (denoted by the blue arrows in the photo above). Lastly, the Sunflowers photo is the largest, and thus takes up the entire composition and can be seen behind the top 2 photos (red arrows). The reason I mention this is that the layer group thumbnail has changed based on the three layers now inside of it, and the new thumbnail looks the same way our canvas looks (outlined in green).
Each individual layer in GIMP has a show/hide icon that allows you to show or hide that layer. The same applies to layer groups, though clicking the show/hide icon for a layer group (red arrow) will hide all of the layers in that layer group (outlined in green).
Additionally, when you have your layer group set to “show” (or click the show/hide icon to unhide the layers once again) you can individually hide layers within the layer group using their respective show/hide icons. For example, I’ll hide the “Field” layer inside the layer group (red arrow), which will cause it to temporarily disappear (and the layer group thumbnail will update to reflect the change). I’ll click the icon again to unhide it.
Layer Group Masks
In my last GIMP Layers article on Layer Masks, I discussed, in great detail, what effects can be accomplished when using layer masks on a single layer. Well, with layer groups you can add a layer mask to each individual layer within a layer group, as well as add a layer mask to the layer group as a whole. This layer group mask, as its called (which is only available in GIMP 2.10 or newer), will apply the layer mask to all of the layers within the layer group – even if they already have a layer mask (the layer mask effects will be compounded).
To demonstrate, I’ll start by adding gradient layer masks to the top two individual layers in my layer group. I want to essentially hide the major portions of these images that do not contain the model. This first part of this section (adding a layer mask) will be a bit of a review from the Layer Masks article.
Starting with the Hiker layer, I’ll right click on the layer and go to “Add Layer Mask.”
Under “Initialize Layer Mask to:” I’ll choose “White (full opacity).”
I’ll repeat these steps for my Field image layer so that the top two images in my layer group now have a white layer mask (outlined in green in the photo above).
Going back to the Hiker layer mask (make sure you are editing the layer mask by clicking on the layer mask thumbnail (the layer will have a green dotted line around it when the layer mask is selected) , I’ll grab the Gradient tool (red arrow). I’ll make sure my foreground color is black (blue arrow), and that the gradient is set to “Foreground to Transparent” (green arrow). I’ll also ensure the gradient shape is set to “bi-linear” (yellow arrow).
Now, I’ll draw my gradient on the layer mask for the Hiker layer towards the middle of my layer (red arrow), going outward towards the right edge. This will cause the middle of my image to become transparent, fading to full opacity at the edges.
This is actually the opposite effect that I am trying to accomplish, so I’ll click the “Reverse” icon in the Gradient tool options (red arrow).
I’ll also adjust the starting and end endpoints, as well as the midpoint, to get the effect I want with the layer mask using the gradient tool. (If you aren’t totally familiar with the gradient tool, I recommend checking out my Gradient Tool video tutorial on the subject). Once everything is how I want it, I’ll hit the enter key to apply the gradient.
You should now have the hiker in the middle of the photo, with the edges fading to transparency.
Next, I’ll move on to the “Field” layer mask.
I’ll keep all my gradient tool settings the same, only changing the shape of the gradient from “bi-linear” to “linear” (red arrow in the photo above).
Next, I’ll draw the linear gradient on my Field layer mask. I’ll need to click the “Reverse” icon once again to make sure that the right areas are transparent and opaque (I want the model to be visible). I can adjust the starting and ending end-points (red arrows), as well as the mid-point (blue arrow), to have my gradient positioned the way I want it. I’ll then hit the enter key to apply the gradient to the layer mask.
Our top two layers now have layer masks, but our third layer is not properly positioned. I want to move it over a bit so that the model isn’t obstructed by the two photos in the layers above.
To do this, I’ll just grab the Move tool from the tool box (red arrow). I’ll then click on any of the pixels from the Sunflowers layer (blue arrow) and drag the layer to the left.
I also want to reposition the Field layer. So, with my move tool still selected, I’ll make sure I am clicked on the Field layer (denoted by the red arrow – I have to do this otherwise I will move the layer mask and not the layer itself), and will then click on the pixels from this layer (blue arrow) and click and drag the layer to the right (don’t click anywhere where the image above overlaps this image to avoid accidentally moving any elements from the top layer).
Alright – now the composition is coming together. The top two layers have layer masks, and the bottom two layers have been repositioned. However, the three layers are still all different sizes, and you can see those areas where the layer boundaries don’t match up. To fix this, I’ll create a rectangle selection area around the areas I want hidden, then add a Layer Group Mask that will apply to all three of my layers in the layer group to hide the areas outside of the selection area.
So, I’ll start by grabbing my rectangle select tool from the toolbox (red arrow) and will draw a rectangle whose edges stop at the smallest layer’s boundary (blue arrow). So, the boundaries of the larger images will be outside this rectangle.
To add a layer group mask, right click on the layer group at the top (blue arrow), then go to “Add Layer Mask” (red arrow).
Under “Initialize Layer Mask to:” I’ll choose “Selection” since I want to mask out the areas outside of my selection. Clicking the “Add” button will add a layer mask to our layer group.
As you probably noticed, creating a layer mask for a layer group is the same process as creating a layer mask for an individual layer. Additionally, when you click on the layer group mask to edit it, you will see that it is active because there will be a dotted green line (red arrow) around all of your layers in your layer group.
I’ll hit ctrl+shift+a or go to Select>None to deselect the rectangle selection that we drew. Now, everything that was outside that selection area is transparent thanks to our layer group mask (blue arrows in the photo above). Plus, this layer group mask was combined with our two other layer masks to create a compounded effect.
After we’ve added our layer group mask, the areas that were masked out have now become transparent. I’ll add a new layer and move it outside the layer mask so that we have a background for our composition.
I’ll start by clicking the “New layer” icon in my layers panel.
Next, I’ll change the name of the layer to “Background” (blue arrow) and will set the background color to “Foreground Color” (green arrow) – which is currently set to black (red arrow). This will create a black layer. I’ll click “OK” to create the new layer.
Our new layer is inside the layer group, so I need to click and drag it above the layer group to move it outside the layer group (red arrow).
By doing this, the black layer now obstructs our entire composition. So, I’ll click the orange “Lower this layer one step” arrow icon in the layers panel (denoted by the red arrow in the photo above) to move the black background layer below out layer group. Now the black background fills in the transparent areas, making our composition look complete (see the image below).
Multiple, or “Nested,” Layer Groups
Our composition is complete, but I want to note one last thing to wrap up this article. You can have what is called “nested” layer groups, or in other words you can have layer groups within your layer groups. You are not limited to just one single layer group.
If I click the “Create a new layer group” icon, I can then drag this new layer group inside of my existing layer group (red arrow).
I could then create new layers to place inside this nested layer group, or can could click and drag existing layers from this layer group into the nested layer group.
As an example, I’ll click and drag the “Hiker” layer into the nested layer group. Just like with any layer group, the nested layer group’s thumbnail will update to display the visible items in the layer group, and the layer inside the layer group is indented (all of this is highlighted in green in the image above). You also have the collapse and expand icons (the “+” or “-” symbols). Finally, I could also add another layer mask to this nested layer group, allowing me to add even more effects to the existing composition (not pictured).
Layer groups in GIMP add a ton of functionality to your compositions, allowing you to create complex effects – especially when combined with layer masks and layer group masks. Nested layer groups further expand these capabilities, opening up GIMP to a world of potential for photo editing and photo manipulation. That’s it for this article on Layer Groups! It also concludes my series on Layers. If you enjoyed this article or series of articles, don’t forget to check out all of my GIMP Help Articles, GIMP Video Tutorials, and Premium GIMP Courses and Classes.