Tuesday, March 3, 2009

Photoshop Tutorial: Shrinking the Depth of Field

I've decided to make Tuesdays interesting by posting a photoshop or photography tutorial, of my own creation, to the blog. In fact, I'm gonna call it "Tutorial Tuesday." Why? Because I like alliteration. It's a little cliche, but it works for President Monson, so what the heck.

Today's tutorial, then, is on shrinking the depth of field in a picture you've taken. If you're not sure of what depth of field is, read the following paragraph.

Depth of field (DOF) refers to the range of distance within the photograph that is sharp. Low DOF blurs the background and foreground. High DOF puts the entire image in focus. Changing the DOF in an image is done by changing the focal length of the lens (zooming in or out), by changing the aperture, and by moving towards or away from your subject.

So why shrink the depth of field of a picture you've taken? Well, consider the following picture:

This was taken at an amazing, old cemetery a few weeks ago. I didn't want to step in the snow, so I couldn't get really close to the gravestone and I didn't have my zoom lens with me, so I knew the DOF wouldn't turn out quite like I wanted it to. Sure enough, when I pulled this shot up on my computer, I saw that nearly the entire image was in focus. Lame. Right now, my eyes have a hard time deciding what to focus on. We're going to help them by decreasing the depth of field to just around the headstone.

First things first, click on the picture above to see the larger version, then right click on the picture and save it to your desktop. Open the picture with Photoshop. The image will (by default) be on the background layer as seen below:

Duplicate that layer by right clicking on the layer and selecting "Duplicate Layer..."

You'll see a box pop up that gives you the option to name the layer. You can name it "blur" or something if you'd like, because that's what we'll be doing to this layer. I left mine as the default, which is "Background copy". Click "okay". You've now got two identical layers.

With the top layer selected, navigate to the filter menu at the top of the photoshop window and select filter > blur > Gaussian blur as shown below.

It will bring up a window that looks like this:

Enter 2 as the value in the box like I've done above and click okay. This will blur the layer that sits over our original image, as seen below:

Now, what we want to do is apply a mask to the blurred layer. This will allow part of the sharp layer underneath to show through. To do so, with the blurred layer selected, click on the "add layer mask" button at the bottom of the layers palette.

When that button is pressed, your layer will have an empty mask on the blurred layer, as seen below:

The mask is a black and white representation of what will be transparent and what will be opaque. Black represents transparent areas of a layer while white represents opaque areas. As you can see, the mask is entirely white right now, which is why the blurred layer is completely opaque. We'll add a black-to-white gradient to the mask to get a nice, smooth transition between the transparent part of the layer and the opaque.

To do so, select your gradient tool on the toolbar. It looks like this:

(By the way: If you see a paint bucket in place of the gradient icon, click and hold the paintbucket until the option appears to switch to the gradient tool.) Now you need to be sure you have a black-to-white gradient selected, so click on the big gradient up top near the menus and this window will pop up:

Select "Black and White" from the list and click "OK". Don't mess with any of the other settings.

Click on the image where you want the sharpest point of the depth of field to be (for me, just above the bottom of the headstone) and drag upward to where you want the transition from what is sharp and what is blurry to end. See the picture below for more clarification:

The image will now look like this:

Notice how the bottom of the picture is sharp, but gradually fades to blurry. That's the gradient mask in action! There is still a big problem, though, in that the top of the gravestone is blurred and looks funny. We'll fix that by painting our mask pure black where the headstone is. Remember, black = transparent for a mask, so that area of the blurred layer will become transparent.

Select the brush tool as shown below:

And then click on the little arrow (up where I've written "size selector") to select the type and size of brush. The following window will drop down:

Select the 9 point, hard round brush. With that brush selected, make sure your foreground color is set to black.

If the foreground color is set to another color, simply click it and set it to black.

All there is left to do is paint with this brush over the headstone. As you do, you'll see the sharp layer underneath the blurry layer come through. This is because you're painting the black onto the blurry layer's mask, making that part of the layer transparent.

The finished product should look something like this:

It's not a perfect replica of what real depth of field looks like, which is why it's always better to just get it right when you shoot the picture in the first place. However, there is remarkable improvement over the original.


P.S. Next week, I'll write the tutorial Monday night, so it'll be out on Tuesday. :)
P.P.S If you don't own Photoshop, I hope this wasn't too awfully boring for you. At least now you can impress your friends with terms like "layer masks" and "gradient fill".


  1. What a fantastic idea to share your Photoshop knowledge! I guarantee you that I will be trying this out sometime!

  2. remember when you were going to teach me how to use photoshop? well, you finally are!!! yeay! thx barrett james!

  3. Cool. :) I wonder if GIMP is close enough to Photoshop that this tutorial will help people with that if they don't have Photoshop.

    Do you take requests? If you do, I'll have to try to do something on Photoshop and get frustrated and then ask you. :)

  4. I do take requests! If anyone would like to learn anything in particular about photoshop, send me an email at barrycann@gmail.com and I'll address it in a future tutorial!