*** From the Archives ***

This article is from January 19, 2005, and is no longer current.

Photoshop How-To: Lens Blur with Alpha Channels

When the subject of your photo is in sharp focus against a blurry background, the subject stands out, seeming to jump right at the viewer. Even if you didn’t shoot the image that way, you can get the same effect with Photoshop CS’s Lens Blur filter.
Compare these two images. Even at a very small size, it’s easy to see how even a little blurring helps separate the subject from the busy background.

The image on the left was shot at f/16 and the image on the right used an aperture of f/5.6. The difference between the aperture settings produces the difference in the “depth of field,” the distance from the lens that remains in focus.
In Photoshop, use the Blur> Lens Blur filter to accomplish the same effect. The key to Lens Blur is an alpha channel, a channel in the Channels palette that you use to control where and how strongly the filter will be applied. An alpha channel is, at its root, simply a saved selection. Where the channel is black, the image is protected from change and the filter won’t be applied. Where the alpha channel is white, the filter will be applied with whatever settings you choose. In areas of the image that are gray in the alpha channel, the filter will be applied at a reduced strength. The lighter the gray, the stronger the filter. The darker the gray, the less change to the image.
When creating an alpha channel to use with the Lens Blur filter, keep these rules in mind:

  • The subject (the part of the image you want to remain sharp) should be painted black in the alpha channel.
  • Anything the same distance from the lens as the subject should also be painted black.
  • Whatever is farthest from the lens (or beyond a certain point of your choosing) should be white.
  • Areas between the black and white should generally be covered with a gradient.
  • Don’t forget areas between the subject and the lens! They should fade to blur as well.

In the sample image, we want the calf to be in sharp focus, with the background gradually blurring more and more into the distance.

In the Channels palette, I can click the New Channel button, which creates an alpha channel filled with black. By clicking in the “eyeball” column to the left of the RGB channel, I can see the image and a red overlay that represents the channel. Using the Eraser or the Brush tool with the foreground color set to white, I can paint over the areas where I want the filter to be applied.

Or, as I prefer to do, I can Select All and delete in the Alpha channel, enabling me to paint with black over areas I want protected and using a gradient to provide the fade-to-distance.
Note in the lower image, where the alpha channel alone is visible, that I’ve painted all of the tree on the left the same shade of gray – the entire tree is pretty much the same distance from the lens. The same can be said for the stump on the right.

Once the alpha channel is ready, click on the RGB channel to make the image itself the subject of the filter. (Otherwise you apply the filter to the alpha channel rather than the photo.) Open the Lens Blur dialog box (Filter> Blur> Lens Blur), select your alpha channel in the Source pop-up menu, then adjust the Blur Focal Distance slider until you see the effect that you want in the Preview area.

Should you so desire, you can also simulate different lens iris configurations, adjust the brightness of specular highlights (pure white areas), and even add some noise.
Compare the before and after shots:

This story brought to you by the National Association of Photoshop Professionals (NAPP). Copyright © 2005 KW Media Group. Photoshop is a registered trademark of Adobe Systems, Inc.
 

  • Anonymous says:

    I am using lens blur for the background, have started an alpha 1 and am removing the “red” from unblurred areas. I saved the file as .psd, but when I reopened it and started painting the rest of the red areas to remove the red all I get is white paint…please advise.

  • Anonymous says:

    That’s a great attitude, I hope the incoming comments and suggestions are equally positive. I know I’ve said it in person, but for anyone reading the comments, its awesome!

    onlineselling
    http://www.skilch.com

  • daniel matthew says:

    Interesting, very interesting blog, you can do way better, keep it up. behance.com

  • Philip says:

    I want to make a graduated selection so that I can apply blur (or any other filter or operation) to dark parts or light parts only, but I want the programme to find the dark bits and make a kind of dark to light gradient, so the effect is not either on or off (a bit like what you have done above, but not automatically on the basis of how light/dark. I am sure I can do this using an alpha channel, but don’t know how….. can you help

  • >
    Notice: We use cookies on our websites to give you a great online experience. If you keep browsing, we'll assume you're ok with this. For more information, see our privacy policy. By closing this banner, you agree to the use of cookies.I AGREENo