Changing background in Photoshop can be challenging at times because you have many things to get right to get your image to look realistic

In this tutorial, you will learn the formula that will help you change background in Photoshop easily that will look realistic every time.

We’re going to start by learning how to select and mask a subject, you’ll learn how to match scale and perspective by matching horizon lines, then we’re going to move on to matching the color of our subject to the background and create a cohesive image, and lastly, you’re going to learn how to create a realistic depth of field effect

so if you’re ready to follow along with this tutorial, make sure to download the project files down below, and let’s get started.

I already imported the background image that we’re going to be using in today’s example, and I also have the subject image on another layer, which we’re going to start by removing its background.

change background in photoshop

1 – How to Select Subject and remove the Background

So the easiest way to remove the background of this image is to use Photoshop’s select subject feature

so start by selecting the subject layer then go to select > subject.

If you have the latest version of Photoshop, you will see that the select subject feature is now much more robust and it can make very accurate selections automatically, 

to see your selection better, you can click on Q to toggle the quick mask mode and as you can see, most of the subject is selected.

Now we can enter the select and mask panel so we can further modify this selection and to do that, you’ll need to select any selection tool, you’ll see the “select and mask” button at the top, click on it to enter the select and mask panel.

Your view may be different than mine, and you can change it by clicking on “view” and changing the view mode, in this case, it’s on layers, but you can change the view to “black and white” to see the mask, you can change it “on layer” and you can also use the opacity slider to control the visibility of the background.

So I’m going to switch the view to “on Black” and if I increase the opacity, you will see that the subject has some halo effects on the edges and we’re going to need to fix that.

The first thing you can try is to switch the refine mode to “color aware” or “object aware”, and this will depend on your image, so you’re going to try one of these modes and see if it improves your layer mask, in this case, we’re going to keep this to object aware

the next thing that I want to do is to shift the edge a little bit inside, so if I use the shift edge slider and move it to the left side, you will see that the layer mask is contracting inside therefore it’s removing that fringing, 

but in this case, we have a complicated selection of the hair so if I move this slider too much, I’m going to lose the details and the hair, so i’ll keep the value of this to about what -7%, and I’ll show you a different way to fix the edge fringes.

The other thing that you can try is to use the “decontaminate color” check box, and if I check it, You will see that it’s fixing the edge halos in some areas, but it’s not working that much on the hair. 

This might work better if you have a white background, but our background image is a little bit dark and we’re going to need to try a different way, and you can always switch the view to on layers and see how your layer mask is working with the background, so you don’t have to do a lot of unnecessary work.

In this case, the hair edges are not looking all that bad, we can also use the refine edge tool on the top left corner and use the brush tool to paint on the hair and improve the edges.

This selection is good enough for now,  now all we need to do now is change the output mode at the bottom to “new layer with layer mask” so we can still work non-destructively, and click on ok to export

Now let’s fix that color fringing at the edges

so with the layer mask selected, take the lasso tool L and select the areas that have halos on the edges, hold shift to add to the selection to select more than one area.

Now go to filter > other > minimum.

In this case, I kept the radius to 1px, and as you can see the edge fringe is not totally removed.

The minimum filter will contract the mask inside, therefore removing the edge Fringe.

so click on ok to accept, and ctrl/Cmd + D to deselect, and now our selection is looking pretty good.

So now that the subject is masked out, let’s move on to the next step which is matching the perspective of the subject with the background.

2 – How to Match Perspective

One of the most important things to creating realistic composites is matching the perspective and to make the scale of the subject look realistic and belongs to the background, we need to match something called a horizon line, 

if you don’t know what a horizon line is, make sure to watch the “How to Match Perspective” video, where I show you in detail how to match perspective and vanishing points. 

And basically, a horizon line is where the sky and the ground meet together, So if I hold shift and click on the layer mask of this image, you’ll see that the horizon line of the subject image is right about here.

You can also use the line tool and follow the leading lines and that will also give you your vanishing point, which will also be where the horizon line is.

And the horizon line of our background is going to be right about here.

again, as I always say, in my tutorials, you don’t have to create a very accurate vanishing point to match the perspective, all you need to do is to have a close enough assumption of where the horizon line is and your image will still look realistic

So now all we need to do is to align these two horizon lines together and we’ll get an accurate perspective. 

let’s do that right now, turn off the layer mask of the subject layer by holding shift, then take the line tool and draw a small line of the horizon line of the subject for your reference, then move both the subject and the line layers and align them with the background

and as you can see, just by doing this, the scale of the subject is now looking much better. 

Now we can also scale our subject based on that horizon line, 

To do that click on ctrl/cmd + T to bring on free transform, And what you need to do is to move the anchor point and align it with the horizon line. 

And if you hold alt or option when you’re scaling, you will see that the subject is scaling based on that point, and it will scale in perspective.

Now that we have our perspective matching, let’s move on to matching the color with the background.

3 – How to Match Luminosity

To match the color of the subject to the background we will be using a curves adjustment layer, and if you are new to curves and feeling a little overwhelmed, you can watch my color matching tutorial, where I show you how to use the automatic color adjustment algorithm of curves, and I also talk in-depth about matching color using adjustment layers and check layers. 

now, select the subject layer, then create a curves adjustment layer at the top, we also want this adjustment layer to only affect the subject, so right-click on it and choose “create a clipping mask”

we can now make any adjustment and it will only affect the subject.

our background image has faded blacks and it also has a warm red tone to it, so we need to replicate that on the subject.

So the first thing you are going to do is add a black and white adjustment layer and change its blending mode to “color”, now we can see the image in black and white and focus only on the luminosity

Now to fade the blacks like the background image, move the bottom graph point of the curves adjustment layer to the top a little and adjust the black values until it matches with the background.

for this image, i faded the blacks to match the background image, then darkened the midtones, and i also improved the highlights as shown in the image below

Now that we have the luminosity matching, we can turn off the black and white adjustment layer, and now we can start matching color.

4 – How to Match Color

for color, i added blue and red to the shadows, then reduced red from the highlights to protect the skin tones, and then reduced the greens from the midtones.

and this is before and after matching color and luminosity.

As you can see now, the color of the subject is looking much better and it’s matching with the background, but the other thing that it’s bothering me a little bit is the fringing on the hair, So let me show you how to fix that really quickly.

5 – remove edge fringing

start by creating a new layer on top of the subject layer and create a clipping mask, then change its blending mode to “Multiply”

We are going to use the brush tool and paint on the areas that have fringes using a low flow and opacity 

use alt or option to sample a similar color from the hair, and paint on the fringes with a low flow and opacity, and as you can see, this will make those fringing areas darker.

You can also sample with the clone stamp tool to remove fringing on the hair. 

and with that done, that’s pretty much what we need to do to match the subject with the background

6 – Add a Depth of Field Effect

the last thing that you can do is add a depth of field effect, to separate the subject a little bit from the background.

to do that, select the background image, right-click on it and convert it to a smart object. 

Now go to filter > filter gallery > tilt-shift 

if you can’t see the control points, you can click on ctrl/cmd + H to toggle its visibility. 

in this panel, You can move the blur area by clicking and dragging the blur point in the middle, and basically, everything inside the two first lines will be in focus and everything in between will gradually start having blur.

you can use the two dashed lines to control the transition of the blur, so in this case, we want the bottom area to be in focus, so we need to move the bottom lines all the way down, and we want the blur to start at the bottom and gradually fades in the background.

then we can set the amount of blur, in this case, 14px looks good, click on ok and that’s pretty much it

as you can see, we were able to get a realistic result and that’s by breaking each step individually and doing it the right way.

So we started by selecting and masking the subject properly, then we fixed and matched the perspective, after that, we matched the luminosity and the color of the subject with the background 

and lastly, we applied a depth of field effect to add a little bit of separation of the subject with the background and make the image cohesive overall.

Again, make sure to watch the “How To Match Perspective” and “How to Match Color” videos, if you want to learn more about matching perspective and color in-depth

I hope this tutorial was helpful for you, thank you guys so much for reading, and I’ll see you in my next tutorial. ✌️