Creating Depth Of Field With Filters and Masks

Creating Depth Of Field With Filters and Masks


Depth-Of-Field-FinalIf you’re looking to create a shallow depth of field in post production today food blogger Danny Jauregui from Food Bloggers Unite! shares some tips on how to create this effect.

Food photography is currently dominated by rich images of mouth-watering food within blurry and atmospheric backgrounds. Shallow depth of field is all the rage, and in this tutorial I will show you how to re-create this effect using PhotoShop filters and masks. This technique is especially applicable to food photographers but is equally beneficial to portrait and still life photographers wanting to shift attention away from distracting backgrounds.

Why Use This Technique?

Below are a few reasons to try this technique:

  • You want to soften a busy and distracting background of a portrait
  • A food photograph lacks spatial depth
  • The photograph is missing visual emphasis
  • You want to add atmospheric mood to a photograph

Sometimes when shooting with small F-Stop numbers the inherit shallow depth of field isn’t enough to give you the desired effect, and that is when this technique can be a life saver!

Creating Depth Of Field With Filters and Masks Tutorial

In the tutorial below, I use this technique to blur out the foreground and background of the image, leaving only the macaroons in the center in perfect sharpness. The photograph needed spatial depth since I wanted to create the illusion that the row of macaroons continued forever.

Step #1 – Duplicate Layer


Open your image in Photoshop and duplicate the background layer. You can do this by going to Layer > Duplicate Layer in the top menu. You can also click and drag the Background Layer into the “New Layer” icon at the bottom of you Layers Palette.

Step #2 – Blur Duplicated Layer Using Lens Blur Filter


Making sure that the duplicated layer is highlighted in the layers palette, go to Blur > Lens Blur. This will open up a new filter window. This filter dialogue box has many variables. The source should be set to “none”. Here are other important variables:

Radius: Controls the amount of blur
Brightness: Controls the brightness of the highlights
Threshold: Controls how much of the image turns into highlights
Noise: Adds texture and film grain to the image

Depending on what affect you are after, try different amounts of blur, highlights and noise. The greater amount of blur you add, the more dramatic your image will become. Once you are happy with the results, hit ok. Your entire image will now be blurred. The blurred layer should be on top of your original sharp layer.

Step #3 – Apply Layer Mask To Blurred Layer

Make sure the blurred layer is highlighted in the layers palette. Next, add a layer mask to the blurred layer by clicking the “Add Layer Mask” button at the bottom of the layer palette. Layer masks work by using the color white to reveal the active layer and the color black to hide the active layer.

For this technique we want to hide certain parts of the blurred layer so that the sharp image below is made visible. We will do this by using the paintbrush tool.

Step #4 – Add Black To Layer Mask


Select a large, soft paintbrush from the toolbar. The brush should be large enough to cover the area you intend to keep sharp. In the macaroon photograph for instance, I chose a brush size that was equal to the size of the macaroons in the center. Next select black as the foreground color in the color palette and change the opacity of the brush to 30% in the options menu near the top.

Before painting with the brush, choose which area will be in focus and which will be out of focus. In the macaroon photograph, I wanted only the macaroons in the center to be sharp, so making sure the layer mask thumbnail was selected, I painted from left to right in the center of the image, creating a thick horizontal band of black.

The area in the blurred layer that was painted black allowed the sharp layer from underneath to be shown….and voila! Shallow depth of field!

Step #5 – Finishing Touches

You might need to use a smaller brush to properly delineate edges that have not been fully hidden. These edges, if not properly hidden, can result in a ghost like edge. Once all of the painting is complete, select and highlight the sharp layer below and apply a small Unsharp mask, thereby sharpening the bottom layer and intensifying the effect. Once you are happy with the results, flatten the layers and you are done!


Danny Jauregui is Los Angeles based food blogger. His new blog, Food Bloggers Unite! is a one-stop resource for beginning food bloggers. His recipes and food photographs can be seen at

Read more from our Post Production category

Guest Contributor This post was written by a guest contributor to dPS.
Please see their details in the post above.

Become a Contributor: Check out Write for DPS page for details about how YOU can share your photography tips with the DPS community.

Some Older Comments

  • Linda from Blue Bell Designs August 3, 2011 01:21 am

    Hey i really enjoyed this tutorial. There are times when I take a picture and I just didn't get the DOF correct. Or I changed my mind after seeing it on my computer monitor. I love the ability to fake a nice shallow dof. So thank you Danny for sharing it.

    i just wanted to mention that in step 1 you can also use cmd + J (or cntrl +J on a PC) to duplicate the layer.

  • Bryan Grant November 1, 2010 12:55 am

    In a perfect world while shooting portraits or weddings i could use a 1.2 or 1.4 50mm but for live subjects adding in DOF can be very useful. but i agree gradient tool is much better for creating this effect in a more "natural" way

  • alicelily June 27, 2009 03:48 am

    I think you can use this sort of technique to really enhance a photo. I used it on this image ( and i don't think it looks too bad :s
    You just need to work with what you have sometimes, i didn't have the right lens for what i wanted on this shot so i created a similar effect. :)

  • Ash May 17, 2009 08:01 pm

    Thanks for posting

    This is a good back up plan for newbies like me who sometimes don't get the dof right when taking the picture. T

  • joel April 25, 2009 07:38 am


    Thanks for the post & the tips. I am seeing similarities with post- HDR tonemapping techniques here, am I right?

    Anyhow, it is a great alternative for the numerous changes that demanding media clients require after shoots are done.

    Chi - what's a "Noob" and may I use it freely? And - with all due respect - It is great to get both sides of the story here, but the "no"s gotta up the class a wee toddle...

  • Chris April 18, 2009 03:26 am

    @chi - Agreed.

    I think that if you can do it in-camera, then do it; otherwise, this gives reader and out... a little forgiveness for previous shots they've taken. People get carried away with being over-critical when they should appreciate someone taking the time to post tutorials such as this. Yes, there is a way to do it without PP, but if you didn't know how to do it PP, you do now. Thanks for taking the time to post!

  • chi April 10, 2009 11:00 pm

    you guys are way to uptight, the effect looks excellent to a person sitting down at that restaurant and ordering from that menu. Only photographers would be this anal about how it looks. This is exactly what it is, an effect created in PP if you jacked up your shoot the first time around.

    It's great that this site has technical people that can pick a tutorial to death. It really gives a noob like me both sides of the story. But to me and probably most of the other people ordering from this menu, this image looks great...definitely good enough to go on a menu, magazine or where ever. This is exactly what it is, an effect created in PP if you jacked up your shot the first time around or if you decided to change it

  • Jeannot56 April 10, 2009 03:36 am

    This kinds of techniques can be useful. I use them for old scanned photos which become more interesting this way. Of course, if you'vfe got the choice, make the DOF with your camera, but if that possibility isn't there, why not use postprocessing?
    SOmetimes you can even do it easier, with just selection parts of the photo and using gaussian blur.

  • Keith Watson April 10, 2009 03:28 am

    I used a similar technique to create a fake tilt-shift.

  • Mrs. Thompson April 10, 2009 03:03 am

    Personally, I loved the technique for what it is! I finally felt in control of where my dof was...which I've rarely felt using gradient masks. Thanks!!

  • hagen April 10, 2009 02:51 am

    Come on people, get out of your needs and understand what the author is trying to do. He's not trying to create a piece of art, nor is he trying for realism nor is he saying "don't use a camera for DOF". He is trying to bring focus on the subject after a shoot when the creative requirements might change within the project (which is not making the photo). This photo will support something else not stand alone.

  • Marte April 8, 2009 06:57 am

    I hope the article's author won't be discouraged forever, but this really isn't a good idea. No matter how good you are at masking, this will end up looking artificial. Just go and buy a lens, it's worth it.

  • Petko April 7, 2009 11:17 pm

    Very nice article but shouldn't it be named *Removing* DoF instead of "Creating"?

  • Noir April 7, 2009 10:47 pm

    As everyone pointed out, the DOF bokeh must be gradual. In this shot doesn't looks THAT bad, but in an image with subjects in different panes it will look terrible.
    Thanks, but no thanks.

  • Will April 7, 2009 10:06 pm

    This article is completely mis-titled! You "create" depth of field by using a small aperture (f11 or more) in order to make sure that as many objects in the frame are as sharp as possible. One can create a shallow depth of field by using a telephoto lens or a wide aperture, which is what this writer seems to be saying. Looking at how people use the term on Flickr and other such places, it's clearly being misunderstood, and people actually either mean "bokeh" or "shallow depth of field". This article really ought to be called "How to Mimic a Shallow Depth of Field Using Filter and Masks". To be honest, I'm really disappointed that DPS should have got this wrong, as they are usually excellent.

  • Hugging the Coast Food Blog April 7, 2009 08:39 pm

    I've been playing with this technique in post production, but I'm definitely going to try this method as well.

  • Danny April 7, 2009 07:23 pm

    I think using a reflected gradient in the quick mask gives a better result personally, but it's always interesting to see how other people approach the same job from a different direction

  • Enrico April 7, 2009 05:01 pm

    Just an observation on the brush vs gradient mask option, I often use various brush strokes at decreasing opacity rates to better control the gradient mask.

    Great post, I saw this technique on some portraits also, and I think it may give very goor results.

  • MeiTeng April 7, 2009 12:12 pm

    I am with Mike. This one's not for me. But thanks for sharing.

  • Mike April 7, 2009 12:08 pm

    Cool post, but I prefer to create my DOF while taking the photograph

  • alwyn April 7, 2009 04:56 am

    For the simple effect of creating focus this post production effect might suffice, but as a proper DOF effect it falls flat and does look terribly artificial unfortunately. I agree with Eugenio, you need a much more gradual effect, as you naturally get with a shallow DOF shot straight off your camera with the right settings.

    As with most things in post production - less is more...

  • tate davidson April 7, 2009 04:35 am

    Eugenio has a good point. Try starting in-camera and using a 50mm lens at f1.4 or 1.8 ... this lens costs a bunch less that Photoshop. Many in-camera purist ideas on this web-site. This one seems strangely backward.

  • Danny April 7, 2009 03:49 am

    Hi there - Danny here..

    As two of you have mentioned, a gradient map can also be used to add the mask, however I find that in a photo like the one in the post, a gradient map adds more mask than is needed, which means more fine detail work to clean up the mask...I tried both methods on this shot and found that I needed less clean up work on the mask if done with a brush. I do often use the gradient map, but I would say that it is dependent on the shot and type of effect you are after. Thanks for raising this issue though, as I think readers will benefit from both techniques!

  • Eugenio April 7, 2009 03:37 am

    Uhm...I'm sorry. It doesn't work this way.
    The focus, or better, the blur effect, should be progressive (I suppose linear, mathematically speaking) from the focused part to the not focused one. Or it will look, like in this case, extremely artificial!
    So, at least, you should not use a brush tool, but a *gradient* one. I'll try an experiment on your picture, I I can.

  • dcclark April 7, 2009 01:15 am

    Clever tip. :) This tip would carry over pretty much without change into Gimp (which I use), which is another bonus.

  • Luciano April 7, 2009 12:43 am

    Great post. Also I think step 4 is better done using a gradient map.