What Is A Layer Mask?
Let's introduce this very, very important topic of layer masks. This is probably, I would say, along with just layers themselves, understanding how layer masks work is going to save you a ton of time, ultimately, and let you be way more creative in how you do things. So I'm going to show you an example of the difference between different methods of doing things. Why erasing and deleting are bad, and layer mask is good. So as an example, I'm just going to take this photograph, as we've talked about before, use that drag and drop method to move her onto this other photograph, there she is there, and now I want to kind of blend her in a little bit. So I'm gonna show you, please if you're taking notes, do not write this down, because don't do it this way, this is just to demonstrate the bad way. If it was up to me, this tool would be hidden in Photoshop and you wouldn't be able to know where it was. Cause the eraser tool works like this. You go and find, I want a nice big soft edged thing,...
brush like that, it's probably a good size. And I start to go like this, and oh, look at that, it's blending in, it's nice. Like this, yeah, perfect, Looks great. I'm going to deliberately make a bit of a mistake though. So there we go, I've erased all that. Well, if you look closely at that layer, those pixels are gone. They're not like, let me go back and change it later, unless you can undo right away, they're deleted. So erase, delete, are the same thing. So, if you later on look and say, why did I cut off the top of her head? It's kind of too late now. Now in this case obviously it really isn't, cause I can step backwards. But in the real world, if you actually did that, and then saved the document, I hope you have another version of that original photograph, because that's not very good. So, some people would say, well, I suppose I could always make a selection, like this, and then feather it, and again, this is not the right way to do it, I'm just showing you the difference. I think in this case, 67 is a good number. Click Ok, and then select the Inverse of course, and then finally hit the delete key, there you go, that looks fantastic, except I cut off too much here, well, it's too late now, cause again those pixels are gone, so erase, delete, bad. Do I ever use the eraser tool? Occasionally, when I just know I should get rid of that little bit right there. But you just have to be prepared for understanding both of these functions, erase and delete, are very destructive, no going back, especially if you've moved on and done something else. So instead, I would suggest, this is a job for layer masks. Because they are a fantastic way to work, cause instead of deleting anything, we're simply going to hide pixels. So we can always get them back again. So this gives you the full ability to do creative editing, accurate editing, anything you want. So basically the way it works is like this. Here's my layer, the two layers, the background layer and the new layer one I dragged it on. And I'm gonna add a layer mask by clicking on this button right down here, which looks like the little black rectangle with the white circle. I could also go to the layer menu, and do it here. What that's going to do is add a second thumbnail beside the first one. So we now have the layer itself, and the second thumbnail, which is this thing called a layer mask. Now initially, when you add a layer mask, nothing happens, because the mask is in this mode called reveal all, which means I haven't hidden anything. Cause the way a mask works, white shows everything, black hides things. So because my layer mask is currently pure white, the entire layer is visible. So instead of a clicking on an eraser, or deleting, or anything like that, all I do is I take my regular painting type tool, I'm gonna use a soft edged brush, cause I want to make sure it has a nice blending effect. Maybe a little bigger. I just make sure that black is my foreground color down here. And wherever I paint with black, it looks like I'm erasing at first, and I'll just do this really fast and bad to show you this, deliberately getting rid of too much, but if you look closely now at the end result you'll see the entire layer is still there, but that big black blob, which is a technical term we use in masking. That big black blob hides those areas. So if I were to show you the layer mask itself by option, or alt-clicking on it, you'll see that's what the mask actually looks like. It's a bunch of black paint, because I used a soft edge brush, there's a little bit of gray in there. And there's white. So the way to think of a layer mask, is white shows, black hides, gray is somewhere in the middle. Some people who like rhymes say white reveals, black conceals. I don't say that. I just say that white shows, black hides. It doesn't rhyme, but it's the same thing, and gray is kinda. So if I used a brush that had a hard edge, there would be no gray, so I wouldn't get that nice blend-y effect, it would be a very hard edge, which you might need in some instances. So in this case, I made the layer mask, by simply clicking on the layer mask button, and then painting on the mask. Now I want to be clear about something, cause I realized for years I've been saying this in a way that might confuse people. And that is, you don't have to use a paintbrush, you just need to get black or white on there. How ever you get it on there is up to you. In other words you can use the gradient tool, you could make a selection and fill with black. It's all the same end result, it's just the act of having black, white and gray, that will make the mask look the way it does. So in this scenario, I look at it and say, I cut off the top of her head, earlier when I used the eraser, I was done. In this case, all I have to do is switch my colors to make white my foreground color, and now when I paint on the mask, I'll be revealing those areas that I previously hid. So unlike deleting or erasing which is permanent, a layer mask is the exact opposite. It's just hiding temporarily, so at any time, you can say, I don't really like that, I'd like to show a little bit more, change my mind, simple to do it, okay. The trickiest part of this, one of the trickier parts, is that now instead of having a layer with one thumbnail, we have two thumbnails. One is the layer information, one is the mask. So if I wanted to change the color for eyes, I'd have to click on the layer itself, and paint on that if I want to hide or show her, I'd have to click on the thumbnails. So now part of our checklist is not just am I on the right layer? It's am I on the right part of the layer? And one of the ways you can tell, it's subtle, but it's a good way to remind yourself, it only works though if you have a situation like this. So currently, I do this again, you can see at the very bottom my foreground color is red, if you can see the color red, that means there's no way that I can be on the layer mask. You might think you're going to paint on the layer mask, but I can't because there's no such thing as color, when you're on a mask. So if you ever start to think, I'll just paint here, don't be surprised when you get red paint. What you need to do, undo that, is click on the mask, watch the foreground color, when I click on the mask, now it's gray, cause you can't have red. So anytime, if you think you're on the layer mask, but you're still seeing color as your foreground color, you can't be on layer mask, it's not possible. So that's one way people are like, I'm not sure if I'm in the right place, that's one of the indicators. If you can still see color in your foreground and background colors, you're in the wrong place. And the other way, it's hard to see, but if you look really closely, see how there's an extra little line around the thumbnail here? If I click on this one, now that one has that extra line? That's the real indicator, to say, I'm working on the layer, I'm working on the mask. And when the question is, well which one should I click on, of course it depends, the answer is, well, what are you trying to do, are you doing more masking? Or are you trying to edit the photograph itself? That will determine which one you're actually clicking on. Okay, good so far? So the other way to make a layer mask, is if you already have a selection. So I'll just do a very simple one using my lasso tool to begin with, like that. If you have a selection, then when you click on the add layer mask button, it automatically says, oh, I assume you want to make a mask based on that selection. And obviously you wouldn't do it in this case, because they're really terribly bad looking selection, but I did that deliberately, sort of, to show you, remember we had that discussion of feathering, I said feathering is kind of a tricky thing? Here's how I would actually feather something. I wouldn't do it, I mean when I made this selection, because one of the things you can do, when you're on the layer mask, is there's a panel called Properties, and I usually have mine up here, so I'll put it up here, so it's easier for us to see what's happening. And when you look in here, see there's a slider called Feather? But this is really interesting. In that little dialogue box we saw before when I right clicked? I typed in some number and clicked ok. Here, I move it some amount, and I click, oh wait, there's not ok button. So you're not actually permanently feathering, you're just for now applying a feather you can always edit. So if you want to end with a feathered edge like this, this is a classy example in my brain of, end up with, I wanted it to be feathered, but instead of making a feathered selection where I was now stuck with that number, Instead, I made a very plain Jane, hard edge selection, and used this feather slider, knowing that at anytime, along with editing the mask itself, in terms of shape, I can also change this, make it more or less. So the net result is, I'm still ending up with the kind of soft edge I wanted, but in a way that's much better. And that's kind of the recurring theme for me is you could do it by putting a feather of 69 or 82, but then that's your number. And if it's too not right, then you have to pretty much go, well, I need to go back five steps and start again. Here I don't have to do that, because it's just a slider, and I don't have to click ok to apply that. It's just like anytime you look at a panel like this one, where there's no ok button, think of it as permanent preview. You never finalize saying, well that's it, that's where I'm at, just for now, I've left it there. So if I were to open this photograph months later, I would try and explore, what settings do I have to look at, one of the places I'd look is the Properties panel, oh good, I've got a feather slider, awesome, that means I can edit that. If I went in there, and I saw feather zero, I'd be a little sad, because it means that, well, that's the way it is, because it would be a lot harder to edit it if it's already set that way, okay? So we always have choices. Now I don't want to suggest that we always have to be non-destructive. Actually I kind of do, but really, it's just a thought process, and you have to decide which way is better. Part of the reason I like this, is let's say for the sake of argument, this was a mask, so I might think, well, I might want to use that on a different photograph too, because it's a nice shape that I really like. If I drag it onto the other photograph, the amount of feathering might not be right for that photo, based on this resolution, et cetera. Now I know I can just go in and adjust the feathering slider, okay? So it's just an approach to do it. So as you're working with layers, if you open a photograph that someone else has worked on, and you see something like this, personally that would make me happy, because now I know I've got the layer itself I can edit, and the mask. If you ever want to see what the layer looked like before you did the mask, you can temporarily hide the mask by shift-clicking on it. That will just, it's still there, but that big red x has, I've just turned it off, so you can remind yourself this is what the entire layer looked like. And if I shift-click again it turns it back off again. One other important note to make about this, look right in between the layer and the mask, there's a little link symbol. By default the layer and mask are linked together, which I would say most of the time makes sense. Because what that means, is I would take my move tool, and I'd drag her head around. I really want the mask to go with it, cause otherwise it would go all out of whack, okay? There are instances, and we'll talk about one in a moment, where you don't want that, because you'd want the mask to actually stay in one place and move the layer around, depends on the circumstances. This is the default way it works, and most of the time, I would say this makes sense, okay? Any layer can have a mask, so you can have like four more layers, and each one could have a mask. You may remember the image we worked with before with the dancer? There were probably two or three of those layers, like a type layer, I was trying to make it look like it was behind her on the wall, so I have to mask the edge of the type, so it looked like it was in behind her. So that's typical functions of being able to do that, is keep type active, but then mask it so you're only seeing it in one area. So in this case, let me show you what it would look like. Add some type. And position it, let's just say, here. But I want to make it look like that's behind her. Well, I can't drag anything behind the background layer, cause that's a whole layer filled with pixels. So when someone says, can you just put that behind her, the answer really is, well, I can make it look like it was behind her, but technically of course it's not really behind her, cause it's a full layer. So what I would do in this case, get a whole lot closer. And probably the way I'd do it, would be something like this. I'd click on the background layer, take my quick selection tool, and drag it around at least to get enough, that should probably be enough like that, cause there's a nice edge there. Then go back to this layer, and click on the add layer mask, but I'll warn you, this will look like it's not working at first. Because remember a layer mask is made based on your selection. So whatever's selected will be revealed so when I click initially on the add layer mask button, it's the wrong way around, cause it's kept that part, where I actually want the opposite, so all I have to do is say, well, so my layer mask is a little bit of white, when the rest's black, I actually need the opposite. I need just a little bit of black. So I use a command called invert, which is command or control "I" cause I don't know what menu it's under, cause I just use a short cut now, but I think it's under Edit, or Image, I don't know. Invert, now I've inverted the mask so now it's the right way around. So guess what, it's another case of end up with. I want it to end up with it looking like the text is going behind her, so I had to make sure that ultimately the layer mask ended up the right way around, okay? So anytime you've added a mask, if you look at it and say, wait, it's the wrong way, whatever's black should be white, and vice versa, just inverse it, invert it, I should say, and then it will do the opposite. Now let's zoom out a little bit here, so I can show you. Remember before how I said that most of the time you want the layer and the mask to be linked together? This would be an example of where that wouldn't be a good idea. Just watch what happens if I move the type. Oh, it's got a bite taken out of it. In this case, if I undo, the mask really needs to stay put. So I do that by unlinking. Now if I click on my type, I can move it around a little bit. See how the mask is staying in one place? However, gotta be careful, my mask isn't very big. So I move too far, now the type is cutting her in half. Which might be kind of cool, but not exactly what I had in mind, okay? So in that case, I just have to make a bigger mask when I do that. But that's kind of to show you the difference between the masks being linked together, often that makes sense, but in some circumstances you want to say, make the mask stay in one place, and move the layer around, so it looks like you're moving behind it. One of the ways I do that a lot, is by something like, the replace the sky idea. I'm going to save this. Close that, I don't need that. So this sky is kind of boring, and I want to use a different sky. So hopefully, oh there it is. One of the things that I would recommend you do, it's very useful, is anytime you have your camera with you, and you're driving somewhere and you see a cool sky, just take a photo of it, and make a folder on your machine called "skies." Cause you never know where you'll take a photo that's otherwise real interesting, but the sky is terribly boring or gray, or something, but you'll see how easy it is to do this replacement sky thing. You want to have a selection of different skies available. So I want to put that sky in this photograph. So what I need to do, is in this one, which I'll call my destination, which is where I want the new sky to appear, I'm going to make a selection. I'm going to use the quick selection tool, because for the most part it's going to be pretty accurate. It needs a bit of detail work probably like down here in this corner, but for now, I'll just start with this. Up until now, every time I've been combining photographs together, I've always used drag and drop, cause it's technically the most efficient way to work, in this case, I can't, cause I need to take advantage of a special command. It only works if you copy and do a special kind of paste. So it's a rare example where copy and paste is actually a better approach. So what I need to do is select every single pixel in this new sky, Select All, Copy, switch here, but instead of just using paste, which if I did that, it would ignore this selection, and make a new layer, and I just wouldn't be any further ahead, instead I use this special command. It's actually called Paste Special, Paste into. And what it will do, is say, take those pixels I've copied, look at the existing selection, and automatically make a mask that's unlinked. So we're not going to do anything else, it's already made a mask, the sky is there, and now if I take my move tool, I can move it around and find a position that I want, that looks good the way I want it. Now I could have done that completely manually, by saying, drag the sky over, make a selection, make a mask, invert it, but this done automatically. So anytime you're trying to put a photograph into some other place, like maybe you want to put a photograph, make it look like it's on a computer monitor, you make a selection of the monitor, you paste into, most of your work is done, okay? Now one of the things, as a tip for you, whenever you're doing a sky replacement, very often, I mean I obviously deliberately picked a photograph that had a nice easy edge, like look, it's a building, but what about if there's little trees or things, that I mean, well those are really hard to select. So one of the techniques I've found works really well, is deliberately take a new sky that's probably too saturated for the existing photograph, this one, it almost works, but it's still a little bit too much, and then because you have a little more saturation than you need, if you lower the opacity of this new sky a little bit, see how the little details down here are suddenly showing up a little bit? Because now I'm letting the original photograph show through just a bit? And that can work really well. I have a photograph I did years ago that I took in Venice, and it was this really cool canal with the buildings but the time we were there the skies were just gray everyday. But when I went to paste the sky, I saw that there were all these antennas and little tiny tree, and there was even a building that had like a see through balcony, like a glass rail. So when I'd try, I was like this is going to take me forever to mask it, so I just lowered the opacity like 10% and went oh, there's all the trees, and I was like oh, I'm gonna use that all the time. Cause instead of me going and trying to go and mask every little detail, and it works best, that's why I suggest, if you have skies that are overly saturated, when you reduce the opacity, it still ends up looking like a nice sky, but it lets some of those other details show through just enough to work, okay? Now, needless to say, the believability will depend entirely on your original selection. So before I paste it into, if I made a really bad selection, and missed part of the building or had too much of this, then it wouldn't work very well. Or if you have a photograph that has all kinds of trees with little leaves and so on, it's going to be harder to make your selection. You might have to use the color arrange tool or something like that. But the idea of saying, take other pixels and paste them into, often will give you a great start, remembering it still creates a layer mask so if I needed to, I could still edit this. So it's not to say, well now I'm done, and it doesn't look very good, if you notice for example, I still need some work down here, you can still work on it, it's just, it's automatically been created for you, instead of you having to say well, I better make this selection and then paint for a long time and things like that, okay? So, this is obviously not only used for replacing skies, it's any time you're trying to put one photo inside another, like you're trying to put inside a frame, or inside a monitor, or anything like that where it just makes better sense to put on the cover of box, anything like that. So please don't think of this as the paste a new sky technique, cause Paste into is for any purpose where you need to combine images in a way like this where it would be easier for you to have it do most of the work for you. Remembering, if at a certain point you decide, okay now I'm done, and I'm ready, and I want to move this into a different photograph, then I would probably make sure the link symbol was back on, cause now it's in the right place. But while you're moving it, you want the mask to stay put, which is why we would unlink it. That happened automatically when I chose Paste into. Normally when you add a layer mask based on the selection, it's linked together which again is one of those things where you have to look at the situation, and say which makes better sense depending on the circumstances. So here's another kind of recurring theme thing here to think about. You'll see lots of times, remember when I was in color range? Color range kind of looked like this whole black and white thing? That's a recurring theme in Photoshop. Anywhere you see mask, or things called channels, or selection techniques, often one of the views that's available is this black and white view. And really, typically, it's a preview of what your mask is ultimately going to look like. In this case, it already is the mask. But we always have to think, whenever you're thinking about a selection, think ultimately black and white. Cause with a few exceptions, sometimes you make a selection for another purpose, but very often, one of the main reasons to make a selection is to make a more accurate mask. So they kind of go hand in hand, which is why I always talk about them together, so if I'm trying to select around something, often the purpose is to make a mask. Shortly we'll talk about how we can adjust images. The way we're going to adjust image. also have a mask. So that's how we can be more selective about adjusting something, is to say, select an area first, and then when I add this adjustment, it makes a mask automatically. So selections and masks to me go very closely hand in hand. Cause that very often the reason for making a selection is to end up with a mask, just because masks are more flexible and accurate. Also as I mentioned, we do have this Properties panel on this case. I don't think it would make a whole lot of sense to feather the edge of this mask, because it already blends in pretty well. Let's just see what it looks like just to show you how feathering can be sometimes not the best choice. If I push this feathering really high, yeah, it's just I don't know, not really adding much to it. It's not helping. Density says, well, right now my mask is black and white, which is what I actually want in this case, but if for some reason you say, I want to see what it looks like if the sky was actually on the front of the building too. Which would be weird. See how the density is actually lowering the layer mask to be shades of gray. Which in some circumstances might work. Certainly not in this one. But again, the reason I show you this, is because this is part of this Properties panel where these factors are editable but not permanent. Cause we're not at any point clicking ok to say ok now we need to apply this. So this is kind of just touching the surface of masks, but it's such a key function, that I think it's really important to understand how much better it is than the alternative, any kind of deleting or erasing. So anytime someone says, okay, I want to move someone from one photograph to another, for example, in the ops, I want to this dancer into another photograph, I wouldn't just make a selection and move her. Cause what if my selection missed a bit of her finger? Then it would be gone. So instead, I would make the selection, click on the Add Layer Mask button, then drag that whole thing over to the new photograph. That way, I still have access to all the other information just in case I change my mind. It's going to make the file size a little bigger, but oh well, I'd rather have that, than the alternative. Spend all this time making a selection, drag her over and then go, oops, I missed her feet and have to start all over again. So, the benefit of using layer masks, there's never that point where like, oh no, I've deleted part of the information. It's always just hidden, not deleted or gone or erased.