Back to Mobile View

Skip to Content

TUAW Deals

How to use Photoshop's Lens Blur tool with masking (Part 2 of 2)


Yesterday, I showed you how to simulate a photograph taken with a tilt-shift lens by using Photoshop CS3's Lens Blur tool. Today, we'll do something a bit more practical: clipping out an object that's not entirely in focus.

Clipping out objects that are out of focus can be something of a chore: either you have a hard, dark edge somewhere you don't want, or you have to settle for feathering the whole thing, leaving edges that should be sharp a little too blurry.

We'll be clipping out this old book, and dropping it on a new surface.

To start, we need to first draw a hard clipping path around the object using the pen tool. Be careful with accuracy around the parts in focus, you don't have to be as careful around blurry edges. Just make sure your path goes about halfway through the blurred edge, and doesn't capture too much of the surface underneath.

Unlike our last tutorial, instead of switching straight to the channels palette for this one, I find it easier to make layers first, and then copy the finished result into a channel.

So, create a new layer, and with the path selected in the Paths palette, choose Fill Path from the palette menu. I usually fill it with black.

Next, we need to create our depth map. We'll follow almost the same steps we did in our last tutorial:

  1. Select the Gradient tool.
  2. In the toolbar, click the "Linear Gradient" button:
  3. Choose black for your foreground color, and white for your background color.
  4. Make sure the gradient you're drawing is gradating from the foreground color to the background color.
  5. In the Channels palette, create a new channel.
  6. Click the channel visibility icon ( ) next to the RGB channel (first in the list).
  7. Now you can see your image (but tinted red), draw a gradient starting where the point of sharpest focus is and drag to the blurriest edge of the object.
  8. Click the RGB channel in the Channels palette.

Groovy! Our depth map is taken care of. Let's make that channel invisible by clicking the eyeball icon ( ) next to it.

We also want to make our black fill a little more translucent, so we can see the extent of the blurriness beneath it. In the Layers palette, reduce the opacity for that layer to zero or 1 percent.

Now we can play with Lens Blur. With our fill layer selected, choose Blur from the Filter menu, then select Lens Blur.

We want to choose a Radius that matches the blurriness of the soft edge in the background. You can move the Lens Blur window out of the way if you need to get a good look at how soft you need to make it.

Once you've chosen a Radius, click OK to make it happen. After waiting the customary few minutes, we'll copy the focus-accurate fill into a channel of its own.

On a layer below our fill, make a layer of solid white, and take the fill layer back up to 100 percent. Merge those two layers, and you should get something that looks like this.

From the Edit menu, choose Select All (or hit Command + A) to select the layer. Copy it to the clipboard.

Now, in the Channels palette, create a new channel. Paste in what you copied. In order to make it useful as a channel, we'll have to invert the colors, so while everything is still selected, hit Command + I to invert the colors. The object should now be white on a black background.

Coolio. (That's right, I'm bringing it back.) You can click the RGB channel in the channels palette, and delete any of the fill layers in the Layers palette -- we won't need them anymore.

If you command-click on the palette preview of the channel you just made, you'll make a selection we can use to pull the object away from the background, keeping the fuzzy edges intact.

With the selection made, click the layer with your object on it, and type Command + J. Voilà! A new layer with our object on a transparent background.

We can now copy and paste the object into other scenes, place shadows underneath, and otherwise have it look natural.

Careful observers will see I distorted the perspective on a flat wood image, and used Lens Blur to make it look like a table in focus with the rest of the book. The possibilities are nearly endless.



Yesterday, I showed you how to simulate a photograph taken with a tilt-shift lens by using Photoshop CS3's Lens Blur tool. Today, we'll do...