This GIMP (GNU) tutorial demonstrates how to blend two images using a Mask Layer.
To work along, you are welcome to download the Cat and Dog Start Images I am working with Here. Unzip the file and open the Start Images onto GIMP’s workspace.
Eraser Tool Blending Versus Mask Layer Blending
With care, you are able to produce the same blend using the Eraser Tool, however, the Eraser Tool lacks the sophistication, accuracy and control of Mask Layers. For example, once you have removed pixels using the Eraser Tool, they cannot be retrieved easily. With a Mask Layer, erased pixels can be painted back at any time: and as long as you save your work as a GIMP XCF File, removed pixels can be painted back even after the image has been closed and reopened. Blend Images Using The Eraser Tool Tutorial Here.
You can quickly Undo a step at any time by pressing Ctrl then Z. Alternatively, click a previous Undo History snapshot - Windows then Dockable Dialogues then click Undo History. In addition, to Zoom in (or Zoom out) of your image; from the top menu, choose View then select a Zoom Tool from the subsequent drop-down list.
Understand Blend Modes
Launch GIMP & Organise Its Workspace & Palettes
Ensure the Layers and the Undo History Palettes are visible, and then drag them into position over your workspace - (Windows then Dockable Dialogues - then click Layers and Undo History).
If you are utilising your own Start Images, you must resize them so they are approximately the same size. In addition, it’s important to choose your Start Images with care: not all images are as easy to blend as my Cat and Dog Start Images.
This is an introduction to Layer Mask Blending, and to keep things simple I am working with two photographs; however, you can blend as many images as you wish. Additionally, all New Layers can be converted to a Mask Layer.
An Introduction To Masking Proceed To My Cat And Dog Blend Tutorial Here
When you create a Mask you are isolating part of an image. This means, you can change the isolated area (the cat’s eyes for example) either by applying filters, or by removing the area altogether. The area outside the isolated area is “Masked”, and is therefore protected from change. In my example below-left, I applied a Rectangular Selection Marquee around the cat’s eyes, I then applied the Desaturate Filter (Colours then Desaturate). And as you can see, the filter has changed just the selected area. In my example below-right, after having first added an Alpha Channel to the Selected Layer (right-click over selected Layer and choose Add Alpha Channel from the subsequent drop-down list). I tapped the Delete Key - (Edit then Clear); and this removed the area inside the Selection Marquee. This is Masking in its simplest form. The Rectangular Marquee has “Masked” the outside area subsequently protecting it from any changes.
Now, if I press Ctrl then Z to step backwards. And then apply the Selection Marquee around the cat’s eyes - then Invert it, (Colours then Inverse). When I Desaturate the Selected area - or press the Delete Key - the area outside of the Selection Marquee is effected, and the area inside is protected (“Masked”).
Masks are stored in Alpha Channels, and Mask Channels are Greyscale Raster images - as such, they can be edited like any other image. Areas painted with Solid Black are protected from changes, and are not editable, and areas painted Solid White are editable. Additionally, Masks contain pixels that can display 254 Shades Of Grey - (256 including Solid White and Solid Black); therefore, for varied opacity - apply shades of grey (as opposed to Solid Black or Solid White); this fades - or blends your images. The levels of grey correspond to levels of opacity, or masking. Solid White pixels show underlying layers; Solid Black pixels hide Underlying Layers; and Grey pixels show varying amounts of Underlying Layers - the darker the grey, the more the underlying pixels are Masked,
Painting With Black, White And 254 Shades Of Grey
There are different ways of Masking images: isolating areas with a Selection Marquee is one way, and applying Masks utilising the Paintbrush Tool is another. However, this blending tutorial concentrates on using Layer Masks, which means we will be layering two images - the Cat and Dog images, adding a Layer Mask to the Dog Layer, and with the Paintbrush Tool, we will remove the dog’s face, so revealing the cat from the Underlying Layer. When completing this lesson the important points to remember are - Solid Black removes the Dog image, and Solid White brings it back. If you remove too much, don’t worry, you can quickly paint with Solid White to bring it back. (Remember, painting with Shades Of Grey removes, or applies pixels - depending on the grey’s intensity).
1/ Lesson - Create A Photographic Cat And Merge
To open the Cat and Dog Start Images onto GIMP’s workspace; from Gimp’s top menu choose File then Open - Ctrl then O. Now, from the Open Image dialogue box, navigate to the folder where your Start Images reside, then Ctrl-click to highlight both files - and then click Open.
Now, from the Dog Image’s Top Menu, choose Edit and then choose Copy.
Then from the Cat Image’s Top Menu, choose Edit and then choose Paste as and then choose New Layer - as illustrated below.
The Dog Image will now be Pasted onto the Cat Image - as illustrated below.
It’s safe to Close the original Dog Image - top menu, then File then Close.
To create a Layer Mask, you must have more than one Layer in the Layers Palette.
4/ Add A Layer Mask
Now, right-click over the Dog Image’s Layer, and from the subsequent drop-down list, select Add Layer Mask.
And from the subsequent Add Layer Mask dialogue box, accept the following default White (Full Opacity) setting, and then click Add.
After clicking the Add tab; a Mask Layer will then be added to the Dog Layer - and the Layer’s appearance will change to the following. The White Rectangle (highlighted in red below) indicates the Mask Layer.
Layer Mask (Rectangle) Note
Whilst editing the Dog Image, the Mask Layer must remain active at all times. If needed, you can reactivate the Layer Mask by left-clicking over White Rectangle (Layer Mask Thumbnail).
Now, tap your Keyboard’s D Key. This sets the Foreground Colour Swatch to Pure Black and the Background Colour Swatch to Pure White - as illustrated below.
(Alternatively, click the following tiny black and white swatch).
To paint with Mask Layers, you must set the Foreground Colour Swatch to Black.
If necessary, click the following Switch Foreground and Background Colours (double arrows tab) - or press your X Key to swap the Colour Swatches around.
When painting with Mask, remember, painting with Black removes pixels and Painting with White brings them back.
You will find the next step easier to achieve if you enlarge your image by Zooming into it. (I zoomed in twice).
Bear in mind, when utilising the Zoom Tool, you need to adjust the Paintbrush Tool’s Size according to the amount of Zoom.
Now, from the left-side Toolbox, activate the Paintbrush Tool.
And to start, select a Hard Round Brush; and choose a Brush Size that’s suitable for your photograph’s needs. I am beginning with the following Paintbrush settings; - however, remember, for a perfect blend, you’ll need to change the Brush Size - and its Opacity - as you work.
You can quickly alter the Paintbrush’s Size (Scale) by tapping your Keyboard’s Square Bracket Keys.
Still working on the Mask Layer, and using the Paintbrush Tool - left-click over your image, and carefully remove the Dog’s Nose - as illustrated below.
Paintbrush Application Note
You can apply the Paintbrush in one continuous stroke. Alternatively, you can apply it one click at a time.
Step Backwards Note
You can quickly undo a paintbrush application by tapping Ctrl and then Z.
Note - Blending Techniques - Continue with tutorial here
If you reduce the Paintbrush Tool’s Opacity to - for example, 30%: painting will remove less of the Dog Layer - as illustrated below. To create a seamless blend, experimenting with the Opacity level is absolutely paramount.
An alternative way of fading images is by changing the Foreground Colour to (and experimenting with) various shades of grey - as fully explained here.
Additionally, changing the Paintbrush Tool’s Blend Mode can provide interesting and useful results. (Understand Blend Modes).
The Dog Layer’s Mask Thumbnail depicts the removal of the dog’s nose by displaying a black blotch - as illustrated below.
Now, slowly remove more of the dog’s face. This displays more of the underlying Cat Image’s Layer - as illustrated below.
Paint Back Pixels Note
If you get over enthusiastic with your Paintbrush Tool, or it suddenly develops a mind of its own and shoots off at an adverse angle - as illustrated below.
Simply change the Foreground Colour Swatch to Pure White by clicking the following swap arrows: - or tap your X Key.
And then paint over the mistake. Painting with Pure White paints back areas that have been removed.
Now, ensure the Foreground Colour Swatch is set to Pure Black and continue to remove more dog’s face pixels.
Reposition The Cat Image Tip
To reposition the Cat Layer: first activate the Cat Layer.
Now, from the left-side Toolbox, activate the Move Tool.
And then drag the Cat Image to a position of your liking.
Remember to reactivate the Mask Layer.
And continue painting with Black - or White, depending on whether you are removing or reapplying the Dog Image. Remembering to adjust the Paintbrush’s Size (Scale) and its Opacity as needed.
11/ Perfect Blending
When using Layer Masks, I find the best way to blend transition lines - as highlighted below; is to reduce the Opacity of the Paintbrush Brush, as previously mentioned here.
Additionally, (working on the Top Layer): experiment with different Blend Modes, and discover how they can facilitate perfect blending.
Now, continue changing the Paintbrush’s Size (Scale) and remove - and reapply as necessary, the Dog Image.
Blur Tool Tip
You can blend the transition line between the cat and dog using the left-side Toolbox’s Blur Tool: setting a low Blur Rate.
Tip - Resize Or Reposition The Cat Image
To reduce the size of the Cat’s Face; first activate the Cat Image’s Layer.
And then activate the left-side Toolbox’s Scale Tool - Shift then T.
(Scale Tool Tutorial).
Now, reduce the Cat Image’s size by gently tugging one of the square repositioning handles - as illustrated below.
It’s always good practice to Sharpen Images after they have been resized.
Then reposition the Cat’s Face under the Dog’s Face using the Move Tool.
Now, activate the Mask Layer - as illustrated below-left. And with the Paintbrush Tool, continue to smooth the transition area between the Cat and Dog Images - as illustrated
12/ The Cat’s Whiskers
Removing the areas around and between the cat’s whiskers requires concentration and
technique. For precision, Zoom right into the image until you can see the whiskers’ pixels - and ensure the full opacity of the cat’s whiskers have been revealed, (paint over them again with Solid Black - to bring them back, if necessary). Now, ensure the Paintbrush’s Opacity is
100%; and ensure the Foreground is Solid White. Then reduce the Paintbrush Size, and carefully remove the areas between and close to the cat’s whiskers.
Be prepared to reduce the Paintbrush’s Size to 1 pixel if necessary.
Isolating the whiskers with a Selection Marquee, and changing the Layer’s Blend Mode, may produce a better blend.
Remember, if you accidentally remove the whiskers, change the Foreground to Solid Black, and paint them back in.
Prior to Flattening the Layers, you may want to save your work as a GIMP XCF File.
After you have removed the areas between the whiskers, and you are completely happy with your result. From the top menu, choose Image and then choose Flatten Image.
Congratulations, your cat and dog blend is complete, and it is ready to save.
Now you are familiar with Mask Layers, you can have lots of fun blending photographs. Depending on your choice of images, the process can be quick - or time consuming. The key to success is practise and patience.
Wendi E. M. Scarth. Top of Page.