Save 10% On Your First Order With WhiteWall. Use Code: EPWW10

Replacing the background in a photograph using Gimp

Here we are going to learn how to replace the background of a photograph and correct the lighting so that the two images are seamlessly combined to recreate a special moment. Michael Bates is your tutor and he's using the free editing program Gimp

|  Gimp
 Add Comment

gimp replace background techniqueThe background of a picture can be considered equally important to the subject matter of the photograph; it sets the mood, creates a context and changes the composition of the image amongst other things.

gimp replace background techniqueSometimes there is a moment that you just have to capture, and even though there may be no real background to speak of the photograph is just too special to just discard. So here we are going to learn how to replace the background of a photograph and correct the lighting so that the two images are seamlessly combined to recreate a special moment, and make a more pleasing photograph at the same time.

Here we have our two photographs; a dark flash photograph, and a daytime photograph of Belvoir castle. What we want to do is place the couple from the first photograph and place them in the scenic grounds of the castle.

gimp replace background techniqueStep 1 First thing we want to do is select the people in the photograph so that we can cut and paste them across into the other image. Since they’re quite an intricate shape it may be best to use the Quick Mask tool to roughly select them then neaten them up after we paste them in using the Layer Mask tool. So select the dashed square icon in the bottom left corner of the image window, and the picture should be overlaid with red.

Now, taking the Paintbrush, set the foreground colour to white and start to paint over the couple. Once you have the outlines sorted, clear all the red from the middle of the picture, then press the Quick Mask button again to switch the transparent area to a selection.

gimp replace background techniqueStep 2 With your couple selected press ctrl and ‘C’ to copy them pair to your clipboard, then enter the background image you want to use and press ctrl and ‘V’ to paste them in. In the Layers pane you should see a new layer called ‘Floating Layer’, right click it and select ‘New Layer’ to place it in the image without merging it with the background layer. You’re done with the other image now so you can close it to keep things simple.

Press ‘M’ to activate the Move tool and drag the couple to a location of your choice, I’ve decided to put them on the path since that makes sense to me. Remember to put them at a height that makes them look like they are really there, keep the background’s proportions in mind at all times when doing this sort of task.

gimp replace background techniqueStep 3 To remove those dark edges and areas inside their arms we could use the eraser tool, however this would make any mistake almost permanent, so for ease of correction we will use the Layer Mask tool. Right click the layer containing the couple in the Layers pane and select ‘Add Layer Mask’, stick with the default setting and zoom in very close to the image. Select the paintbrush and use a small soft-edged brush to paint the layer mask black wherever there is a dark area surrounding the people.

At this stage it is always best to cut ever so slightly into the people rather than leave any black edges remaining; they will stop your image from ever looking realistic if any remain and the soft edges of the brush will make the people blend with the background more realistically. Since we are using the layer mask to perform this task we can reveal any areas we accidentally cover by switching the brush to white by pressing ‘X’ and repainting that part of the mask.

gimp replace background techniqueStep 4 Use Colours>Levels to alter the background brightness; bring the white arrow across to the end of the histogram and then move the mid-grey arrow a little towards the black so that more of the darker tones are brightened rather than just the whites.

Step 5 Now the people are too dark, so use the Colours>Brightness-Contrast tool to bring them up a little and increase the contrast a tad too, so the detail remains despite the change.


gimp replace background techniqueStep 6 The veil is still presenting a problem for us here, as it shows through some of the dark background from before. We will be using the Dodge/Burn tool here but since it is a very difficult tool to use without accidentally over-brightening areas we will first select the areas we wish to improve. Draw around the veil using the Lasso tool (‘F’ key) and hold ctrl whilst drawing an area to subtract that area from your selection or hold shift to add an area to it.

Once you have just the veil selected press the ‘Duplicate Layer’ button under the Layers pane, press ctrl and ‘I’ to invert your selection then press delete to leave the layer only containing the veil. Keep your selection active to make the next step a lot easier.

gimp replace background techniqueStep 7 Enter the new layer and press ctrl and ‘I’ to return your selection to how it was before. Now, press shift and ‘D’ to change over to the Dodge/Burn tool. This will allow you to brighten and darken the image through an interface almost exactly the same as the Paintbrush. You can select the same types of brush, increase and decrease the size and hardness of the brush and even change its opacity.

The only difference is that to use the Dodge tool you click as you would normally and the image will brighten, to use the Burn tool hold ctrl whilst you paint and the image will get darker. The main problem with this tool is that if you draw over a layer then return to it and draw again the effect will be doubled, unlike the Paintbrush, so if you do let go of the left mouse button do not go over a previously coloured area. Since we have our area selected we can just set the brush to a large size, hold the left mouse button and sweep across it to brighten the entire veil.

gimp replace background techniqueStep 8 Right click on the layer containing the veil and select ‘Merge Down’ to fit it to the lady once again. Now all that is left is to try to change the colour and brightness of the couple to make them fit in to their background more subtly. Open the Colours>Hue Saturation dialogue box and, in this case, increase the Lightness value by a few, but avoid washing out the colour altogether, and decrease the Saturation until they appear to be lit similarly to the background. Press ok and they should look pretty much like they are there. All that is left is to sort out the man’s hair so it no longer looks like a solid block.

gimp replace background techniqueStep 9 Zoom in to his head and you can see there is detail there, but the flash on the camera and the original context of the photo have rendered it extremely dark. To remedy this switch back to the Dodge/Burn tool and set the opacity to around 2 (we only want the slightest effect here, otherwise he will look grey), then using a soft-edged brush colour the top portion of his hair. There you have it, the two are dropped into the photo and are blended to a reasonable extent.

Step 10 Finally to remove that red-eye that you have no doubt noticed by now, especially in the man. Select his eyes with the Lasso tool, just draw around one then hold shift while you draw around the other.

gimp replace background techniqueThen open Filters>Enhance>Red Eye Removal. His eyes are very red here, so a high value will be required to remove it all, so set it around 80; the higher the value the more sensitive the tool will be when it looks for red to replace with black, so higher values will remove more red at the cost of eye colour.

Just as a warning this tool will also remove the red from any skin you may have accidentally selected, so make sure you have only selected the eye before applying this tool. Apply the Remove Red Eye to both people’s eyes and you should have an improved version of the original photograph, complete with a new background.

Step 11 Make some final adjustments to the brightness of the couple so that they match the general ambience of their surroundings. Then go into the background layer and open Filters>Blur>Gaussian Blur and apply it; this should make the background appear out of focus meaning that the photograph will look like the camera was focussed on the couple when the shot was taken.

gimp replace background technique

MPB Start Shopping

Support this site by making a Donation, purchasing Plus Membership, or shopping with one of our affiliates: Amazon UK, Amazon US, Amazon CA, ebay UK, MPB.

It doesn't cost you anything extra when you use these links, but it does support the site, helping keep ePHOTOzine free to use, thank you.



Very proud to see a tutorial for GIMP here. I hope it is a trend towards featuring some OpenSource software and maybe even photography and photo editing on Linux.

Great stuff!
MikeRC 17 3.6k United Kingdom

Quote:Michael Bates is your tutor and he's using the free editing program Gimp

...if it's free, why, when I try to download it, do they want my credit card details ?


That should take you to the one that is free.

Sign In

You must be a member to leave a comment.

ePHOTOzine, the web's friendliest photography community.

Join For Free

Upload photos, chat with photographers, win prizes and much more.