Clipping masks are a lot simpler than you might think by definition – they are essentially when you apply a layer mask to a group of layers. That’s it.
This feature was not available in earlier versions of GIMP (before 2.10), and so a lot of users are unaware of how to perform this task in GIMP 2.10 or newer, or that they can even perform the task in the first place. The great news is that you can now easily add clipping masks to layer groups in GIMP. Here’s how.
Let’s use the following example: you have two photos, each of which you want apply a layer mask to to have them fade into one another, and you want to put those photos inside a particular shape (i.e. an ellipse) – which will require another layer mask, but one that applies to both of them. To accomplish this, you will need 3 masks – a layer mask for each layer, and a group layer mask to “clip” both photographs to form a diamond-shaped frame. There are obviously other scenarios that would require a clipping mask, or a layer group mask, but I think this example will sufficiently demonstrate why such a feature is useful.
Step 1: Create a New Document & Import Photos
Go to File>New to create a new document for your composition.
In my case, I went with 2000×1280 for my composition’s dimensions (I’ll be combining two photos that are 1920×1280). I also went with 72 for my X and Y resolutions, and set “Fill With” to “Background Color” (my background color is white, so my background layer will show up as white).
Once you have your new composition created, you’ll need to open up the photos you want to use for your clipping mask. I will be using two photos for this tutorial – one of a man and one of a woman (both sitting on a bench at Union Station) – which I have made available for you to download for free here.
Download these photos to your computer if you’d like to follow along, then open them up as layers into your composition by going to File>Open As Layers.
Navigate to the location of your photo on your computer, click on the file, then click “Open.” Repeat this step for the second photo.
You should now have 3 layers in your composition – with each of your two photos having a layer and the background layer sitting at the bottom (shown in the photo above, denoted by the red arrow). I made the “Woman” photo the top layer, and put the “Man” photo beneath that.
Step 2: Create a Layer Group
Next, click the “Create a New Layer Group” icon at the bottom of your Layers panel (denoted by the red arrow in the image above) to create a new layer group folder.
The folder will be named “Layer Group” by default. Double click on the name to change it to whatever you want (denoted by the red arrow in the photo above). I’ll name mine “Clipping Mask Photos.” Press the enter key on your keyboard to apply the name.
Now, click and drag each of your photo layers into the new layer group folder. (Hint: click and drag the photo layer and hover it over the layer group folder. You’ll know the folder is selected because it will have a dotted line around it. Release your mouse, which will drop the photo layer into the folder).
You can always click and drag your layers up or down to change the stacking order (i.e. which layer is on top vs. which layer is on the bottom), or use the Raise/Lower icons (denoted by the red arrow in the photo above) at the bottom of the layers panel (just make sure you are click on the layer you want to raise or lower in the stacking order).
Step 3: Add the Clipping Mask (Layer Group Mask)
Now that our photo layers are in place inside the layer group, we can add a Layer Mask to the layer group, which will apply a layer mask to all of the layers in the layer group.
Before we add the clipping mask, we want to make sure the mask covers the entire area of our composition and doesn’t get cut off by the layer boundaries of our photos (since the photos aren’t as wide as the width of the entire composition). To do this, we’ll extend the width of our photo layers to the width of the entire composition boundary. Go to Layer>Layer to Image Size (shown in the photo above). This will make the boundary of your active layer, as well as the entire layer group, the size of the composition boundary. (Layer boundaries are outlined by a yellow and black dashed line, whereas the Layer Group boundary is outlined by a light blue dashed line – which you can see when you are clicked on the layer group and not a layer). Repeat this step with the “Man” photo layer so that both layer boundaries have been increased to the size of the entire composition.
Next, since we want the layer mask to be a particular shape (an ellipse), I am going to start by grabbing my Ellipse Select tool from the Toolbox (denoted by the green arrow in the image above) and drawing the ellipse around the area I want to mask out. For this example, I’ll just drag my mouse from the top left corner of the composition down to the bottom right (you can see the area I drew in the image window in the photo above). This will draw an ellipse across my entire composition.
Right click on the Layer Group and go to “Add Layer Mask” (denoted by the red arrow in the image above).
Under “Initialize Layer Mask to:” choose “Selection.” Click the “Add” button (shown above). This will add a layer mask in the shape of an ellipse to your layer group, revealing the background of our composition outside the ellipse selection area.
Hold “ctrl+shift+a” on your keyboard to deselect the ellipse selection area you drew.
Step 4: Arrange Your Photos and Add Layer Masks
Our clipping mask is in place, but we can only see the top photo (which is covering up the photo in the layer below). Additionally, our photos are not properly positioned. To fix this, click on the top layer in your layer group (in my case it is the photo of the blonde woman).
Grab the move tool from your toolbox and click and drag the photo of the woman to the left to re-position it (as demonstrated in the image above).
Next, right click on the Blonde Woman layer and go to “Add Layer Mask.” Under “Initialize Layer Mask to:” choose “White.” Click the “Add” button.
I am going to now make it appear as if our top image (blonde woman) is fading into the image below. To do this, I am going to add a gradient to our layer mask. The gradient will fade from black to white – since black indicates transparency on a layer mask, and white indicates full opacity.
I’ll grab the Gradient tool from the Toolbox and will make sure my foreground and background colors are set to black and white. The gradient itself will be set to “FG to BG (RGB),” (you can set this by clicking the icon denoted by the green arrow – my gradient says “custom” in the photo because I made an adjustment to the gradient after I set it to FG to BG RGB) and the shape set to “Linear.” Make sure you are clicked on the layer mask (denoted by the blue arrow in the image above), and not the image layer, before you draw your gradient.
Click and drag with your mouse from left to right (hold ctrl to draw in “straight line mode” to make sure your gradient is straight), starting just after the woman’s face and ending at the layer boundary (you can see my start and end points in the photo above – my end point has a circle around it). (If you want an in-depth look at how to use this tool, check out my Gradient Tool video tutorial on my channel). If the colors are backwards, hit the “Reverse” button in your gradient tool options (it’s the other button next to the green arrow). Once the gradient is how you want it, hit the enter key to apply the gradient (or grab a random tool, like the move tool).
Next, click on the “Man” photo layer, grab the move tool, and click and drag it to the right to move it into place.
You can always redraw the gradient on the layer mask on the “Woman” layer if you aren’t happy with how the two images fade into one another, or use the move tool to re-position the photos until everything looks the way you want it to.
Step 5: Export Your Image
You can now export your image as a JPEG if you want to keep the white background, or can hide the “Background” layer and export it as a PNG to give it a transparent background.
Either way, go to File>Export to export the composition (shown in the photo above).
Change the name of the composition at the top of the Export window (denoted by the red arrow in the photo above), then select the location where you want to save the file on your computer. Finally, under “Select File Type,” (denoted by the blue arrow) choose whatever file type you wish to save the composition as. Once you are ready, hit Export.
If you selected the JPEG option, you’ll need to select your image quality (I recommend somewhere between 60 and 70 if you intend to upload your photo to a website, or 100 if you plan to print it) then hit Export again.
For a PNG file, just keep all the default settings as they are and hit the Export button.
That’s it for this tutorial! If you enjoyed it, I invite you to check out my other GIMP How-to Articles, as well as my GIMP Video Tutorials!