Join Deke McClelland for an in-depth discussion in this video Selecting in-focus areas of a photo, part of Photoshop: 2014 Creative Cloud Updates.
In this movie, I'll introduce you to one of the most promising new commands in Photoshop. Found under the Select menu, it goes by the name Focus Area. And what it does is allow you to select the in-focus portions of an image independently of those regions that are outside the depth of field. And we're going to use this command to isolate this young man away from his out-of-focus girlfriend, let’s say, as well as the rest of the background in order to create this final effect here. And you can see that we have some very smooth edges when all is said and done.
And normally, this is a pretty difficult operation because, after all, we have some very delicate details in the form of these hairs and some smooth edges as well along the cheek and the edge of the jacket. And we have a very busy background that shares a lot of colors with the foreground, but Focus Area is up to the task. So, what you want to do is make sure that the layer that you want to mask is selected over here inside the Layers panel, and then go up to the Select menu and choose Focus Area.
And you'll see these animated dots in the lower-left corner of the dialog box, which tells you that the command is getting to work automatically. Now by default, we're seeing the masked image against a white background. You can change that from this View pop-up menu to On Black, let's say, or if you want to view the background layer, choose On Layers. I'm going to stick with On White for now because that's going to give me the best sense of what's going on. Now initially, you're not necessarily going to get the best results and that's because the Focus Area command is making some default decisions upfront, but you can adjust these settings to taste starting with the In-Focus Range.
So, if you decide you want to select less of the image, just the most in-focus details, then go ahead and reduce this value by dragging the slider triangle to the left. If you want to expand the selection, then you increase the In-Focus Range value by dragging that triangle to the right. I ultimately came up with a value of 5.5 where this image is concerned. You also have another numerical option hiding here in this Advanced area. So you can expand it by clicking on the triangle, and then notice Image Noise Level, which is useful when you're working with a high-noise image.
I found, however, that I got the best results when working inside this image when I decrease this value to its absolute minimum by dragging the slider triangle to the left. Now, that ends up selecting a little too much of the image as you can see, which is why we have these two brush tools, one of which allows you to add to the selection and the other of which allows you to subtract. And so, for example, I'm going to zoom in by pressing Ctrl+plus, or Cmd+plus on the Mac. Notice that his hair abruptly ends right here next to his brow.
And to confirm that that's a mistake, I can turn off the Preview check box in order to see the original version of the image, and you can see that we have more of a slope to that hair. And now I can turn the Preview check box back on by pressing the P key. So, P is the toggle for that Preview check box. I'm going to reduce the size of my cursor by pressing the left bracket key, and then I'll go ahead and paint like so. And you don't have to paint all the way to the edge, you just have to paint inside the in-focus area. If you go a little bit to far as I have, then you want to switch to this Subtract Painting tool.
However, you can get to that tool on the fly by pressing the Alt or Option key. So, notice right now we have a plus sign inside the brush. If I press the Alt key, or the option key on a Mac, it changes to a minus sign, and now I can go ahead and brush that little detail away. All right, now I'm going to scroll down to this location here and that I'm willing to bet is not part of the male portion of this image. And I can confirm that by once again pressing the P key, which turns off the Preview check box, at which point we can see that that is indeed part of the shoulder of the woman in the background.
So I’ll go and press P key in order to turn the Preview check box back on, and I’ll press the Alt key or the Option key on the Mac, and I'll just paint like so through that region. And you can see that more than does the trick. In fact, it goes too far, which is why now just go ahead and paint some of that shoulder back in. Now, it’s very possible you’re going to to get some ratty edges. Not to worry, we’ll take care of those in just a moment. And so, I encourage you not to worry too much about the quality of the edges while you're working inside this dialog box. All right, we still have a few changes to make here.
I'll go ahead and scroll over to the right side of the image. We're missing a little bit of shoulder and I just want to confirm where it is, so I'll press the P key in order to turn the Preview check box on. It's right about there. I don't want to paint too far, so I just want to keep an eye on it. Now I'll press the P key in order to turn that Preview check box back on and I'll paint down like so. And the thing is that we just have a little bit of shoulder because this is a strap associated with, I'm guessing, a backpack, something along those lines. All right, now go ahead and zoom back out by pressing Ctrl+0, or Cmd+0 on a Mac.
And I'll press the right bracket key in order to expand the size of the brush, and I'll press the Alt key, or the Option key on a Mac, and I'll paint in this region right there. And notice that gets rid of a lot of that background in one swoop. Now, Alt or Option-drag there, I'll go ahead and move the dialog box over to the other side of the screen, and Alt or Option-drag in this corner of the image. Now, it's tempting to try to get into the hairs, into those blue regions right there, but it's really not worth it at this point because any time you choose Focus Area, you're going to have to follow up with an application of Refine Edge, as witnessed by this button in the the lower left corner of the dialog box.
Now, as opposed to outputting this to a selection, I'm going to send it to a layer mask, so that we have the most non-destructive results possible. You can soften the edge if you'd like, but it's analogous to anti-aliasing when using the Magic Wand tool. In other words, it really doesn't do that much good, whereas Refine Edge does a ton of good. And I could just click on Refine Edge in order to bring up the next dialog box, but I'm going to do it differently by clicking OK in order to create that initial layer mask so that we can see this image with some pretty nasty edges going on.
So, I just want you to have a sense for the initial results you'll get with this command, which is why the next thing to do is to select the layer mask by clicking on its thumbnail here inside the Layers panel. Then, go into the Select menu and chose Refine Mask in order to bring up the Refine Mask dialog box. I'm going to go ahead and take the Radius value up to 20 pixels in order to apply some automatic adjustments as you can see here inside the image. So, just to give you a sense, I'll go ahead and return this value to 0, and I'll zoom in as well, let's say, on this portion of his hair.
So you can see we have some very nasty edges going on. As soon as I, as soon as I take that Radius value up, things get much smoother. Now, they're not necessarily the best they can be, but they're better than they were a moment ago. Now I'm going to turn on the Show Radius check box so we can see this area that's represented by the Radius value. So, the radius value goes ahead and carves an area around the edge of the mask, and that's the area in which Refine Mask applies its automatic adjustments. Obviously it's not doing enough right here in this region, so I'll just go ahead and paint inside of it using this brush which is automatically selected, and we get a better result, as you can see right there.
And to confirm that it is better, I'll go ahead and turn the Show Radius check box back off. And so you can see we have much less blue in this region. And now, I'll go ahead and paint in this area as well in order to desaturate some of those colors. All right, now I'll press Ctrl+0, or Cmd+0 on a Mac, to zoom out. And I might paint it a little more just right along this edge there. And then finally, just to make sure that we have as few stray blue edges as possible, those blue edges that we were seeing around the brown hair, I'll go ahead and turn on the Decontaminate Colors check box down here in the output area, and you can see that that really does a number on those blue regions.
So, this is what they looked like before. I'll go ahead and zoom in so we can get a closer look. So, it's pretty settled, but there is some blueness up there. And as soon as I turn on Decontaminate Colors, those blue edges go away. And now notice that Output To switches automatically to New Layer with Layer Mask so that we're not ruining that original layer because Photoshop is actually going in there and recoloring pixels. And now I'll go ahead and click OK in order to apply the final mask.
All right, now press the F key a couple of times in order to fill the screen with the image. And now, press the F12 key just so you can see the original version of the image. This is the image that we started with, with this guy in focus in the foreground and this woman in the background outside the depth of field. And if I press Ctrl or Cmd+Z, we can see the final effect accomplished in large part using the new Focus Area command under the Select menu here inside Photoshop CC.