This Tutorial published at

Simulating Depth of Field using Photoshop Lens Blur Filter--2nd Edition
Posted by: bart_hickman on 12-31-1969.

"In this tutorial you will learn how to create the illusion of shallow depth of field using the Photoshop lens blur filter for version CS3 or later. You will also learn about the unique behavior of this filter. This tutorial is specific to Adobe Photoshop CS3, however there are plugins available (they might even be free) that allow you to achieve similar results to the lens blur filter. For Photoshop CS2, visit"

In this tutorial we will start with this original image shot with large DOF (because it was shot with a P&S camera)

and manipulate it so it looks like it was shot with a shallow depth of field (DOF) like this:

This is a modified version of the tutorial “Simulating Depth of Field using Photoshop Lens Blur Filter” that was written for Photoshop CS2—it took advantage of (or worked around depending on how you look at it) a bug in the Lens Blur filter.  In CS3, the Lens Blur filter was fixed making the old tutorial no longer possible in CS3.

First make a copy of the background layer (I always like to keep the original image untouched in the base layer in case I need it again.)  Do this by selecting the base layer and hitting ctrl-J/cmd-J.  In this tutorial, the new layer will be called, simply, “layer 1”—because that’s what photoshop calls it by default.

In this example the park bench is the subject we want to remain in focus so we start by selecting the park bench.  I used a combination of magnetic lasso and polygonal lasso for this subject due to its simplicity.  If there had been a person with wispy hair I would have also employed the extract filter and/or image-based masking techniques.  I’ll leave the selection to another tutorial as that’s a whole topic of it’s own.

Once you have it selected, save it as an alpha channel for later use.  You do this by selecting the channel palette:

Then click the “Save selection as channel” button at the bottom of the channel palette to transfer your selection into an alpha channel for safe keeping:

By default, Photoshop will name the new alpha channel “Alpha 1”.

Return to the layers palette, clear the selection (ctrl/cmd-D), and create a mask for layer 1 (select the layer and click the “add layer mask” button at the bottom of the palette.)  Then select the mask icon in the layer palette (to make sure it’s active), then draw a black to white gradient starting from the base of the trees in the distance and going vertically to the bottom of the photo.  We’re creating a depth map where black is far away and white is close and grey is in-between.  We will define “in-focus” as some value of grey—in this case it’ll be the value of grey at the base of the bench (which is where I want the focal plane to be.)  The lens blur filter will progressively increase the radius of blurring for gradient values progressively farther from this value of grey.

This figure shows how I’ve drawn the gradient path just before releasing the mouse button:

The path starts at the top (most distant) of the grass and extends to the bottom.  When the gradient is drawn on the mask it looks like this:

I’m not using the mask layer as a mask layer—I’m just using it as a convenient place to store what will become the depth map for the lens blur filter.

Now we need to retrieve our bench selection from “Alpha 1”.  To do this, select the channel palette again, then ctrl/cmd-click “Alpha 1”.  This will transfer the alpha channel back into a selection.

Next, return to the layer palette and alt-click the layer mask for “Layer 1” so it’s visible in the edit window.  What you should see now is the gradient we drew with the bench selection “ants” showing on top:

Now we’ll fill this part of the depth map with the value of grey that will define our focal plane.

I got the eyedropper and sampled the color of the gradient under the bench half-way between the two posts as shown:

Next, get the paint bucket tool.  Make tolerance 255 (the maximum) and uncheck the “contiguous” checkbox.  Paint bucket settings should look like this:

Click the selection to fill it with the sampled value of grey.  Clear the selection and you should now see this:

This is our completed depth map.

Click the layer thumbnail to make the bench photo visible again, then disable the layer mask (you don’t want it as a mask—you’ll be using it as a blur map in a moment.)  Now you should see this:

Make a note of the grey value (it was 213 in my case).  Now open up the lens blur filter.  For the depth map, enter the grey value of the bench which was 213.  This defines 213 as the depth of the virtual focal plane.  Set the source to the layer mask.  Adjust the radius to suit your taste—don’t overdo it.  Here’s how it looks:


Click “OK” and after the filter is done rendering, you’re all done!

This Tutorial published at