Masking 101: Understanding Layer Masks in Photoshop

January 18, 2015  •  Leave a Comment

If I was a betting man (and I definitely am not), I'd be willing to bet a nice sum that just about every Photoshop expert would agree that learning and understanding layer masks is a prerequisite to doing almost anything of substance in Photoshop.  To be clear, I am not professing to be a Photoshop "expert."  That being said, after years and thousands of hours watching Youtube videos and reading tutorials just like this one, I feel that it's time to give back a bit....

What is "making," you ask?  Masks are used to hide and reveal what's on the layer below.  As they're used to do in real life, masks in Photoshop allow you to control how much or how little of an image to reveal from a particular layer (FYI, there is also something called a "Clipping Mask," but I'm only covering Layer Masks here)

Let's get to an example...here is an iguana in Florida doing its thing a bit closer to my golf ball than I would've preferred (but that's a story for another day) and below that is a teenaged elephant I photographed while on my honeymoon in Chiang Mai, Thailand.  Let's say, these equally sized animals wanted to meet, how would we do that.......MASKING! 

FINAL RESULT (let's be 100% clear about the so-called "final" result below: It looks straight-up terrible.  BUT...this tutorial is only to understand what masking is, how it's done and to illustrate how the technique can be extrapolated to do so much more) 

 

(1) Arranging the Layers: Using you're own two pictures - b/c I haven't figured out how to let you download mine - arrange them as layers in Photoshop.  This isn't an indiscriminate choice...the image containing the object that you want to take from it's home and transplant somewhere else must go on top. So here, the plan is to teleport the elephant to Florida, where I will drop him onto the 14th fairway.  To do that I will need to place him on the layer above the iguana, as shown below.  

(2) Masking Button: With the top layer selected, click the button indicated by arrow #1, which will create the little white box to the right of the image on the top layer, as indicated by arrow #2.  This white box is your mask.  

(3) Selecting Your Brush: Masking is done by using your paint brush to literally paint away the part(s) of the image that you want to hide and/or painting in the part(s) that you want to reveal.  While operating in "mask land," we are dealing with only black and white brushes.  The formula is simple: BLACK = HIDE // WHITE = REVEAL.  Looking at your current screen, the mask to the right of your image is white and therefore everything looks the same as when you started, that is, the entire top image is still covering the background image (shown below).  But, if you click on the white mask box and press "Cmd + I" to invert the mask to make it black, you will see that suddenly the entire top layer becomes hidden. We'll play with this a bit more below, so for now, press Cmd + I again to put the mask back to white. 

  • SHORTCUT #1: Pressing the letter "D" automatically resets your foreground/background colors to black and white
  • SHORTCUT #2: Pressing the letter "X" toggles the background/foreground colors (middle screenshot)
  • SHORTCUT #3: Pressing the letter "B" automatically selects the Brush tool (far-right screenshot) 

(4) Painting  (i.e., "masking") Away the Image:  We should now have our all-white layer mask selected, with the foreground color set to black and a soft brush selected.  Remember, the reason the brush is black is because I want to hide everything in the elephant picture except the elephant itself. To select a soft brush, while the brush tool is selected (which it should be now) right-click anywhere on the image and put the "Hardness" all the way to the left.  

  • TIP: If the image is selected on your Layers palette - rather than the layer mask - and you proceed to paint black or white onto the image, you will literally be painting the actual image black or white and this is bad lol.  So be sure that the layer mask box is selected in the layers palette before painting anything onto the image.  

Now with a black brush selected, start painting away the areas around your subject (for me, the elephant) and you will see the background (for me, the iguana) suddenly start to appear, as shown below:  

After continuing with this for a few minutes, I am basically done masking away all the extraneous parts around the elephant and my final layer mask box (second screenshot below) shows all of the areas around the elephant as black and a white silhouette of the elephant itself: 

(5) A Few Extra Notes About This Image: 

  • Selections: As you'll see from my screenshots, and almost certainly from your own image, using the brush tool to carefully free-hand trace the edges of the subject does a pretty crappy job at creating a realistic composite...the edges of the elephant are really soft and shaky, you lose all of the fine detail along the edges of the elephant's skin and there are very obvious pieces of stray dirt and grass from the image that I missed while painting.  As I said above though, this was a purely conceptual masking tutorial.  In real life, there are a dozen ways to very precisely select the elephant and preserve every nitty gritty detail along the edges, but that's a whole other tutorial, which I will definitely cover in a separate post. 
  • Resizing:  After masking out the area around your subject, you will most likely need to resize it to better fit the new background. In my case, the elephant was way too small, so with either your image or layer mask selected (doesn't matter this time) hit Cmd + T which will bring up a box with four points.  Now if you simply started dragging these boxes you would make the image larger or smaller but you would also ruin the proportions and degrade the image, so to preserve the proportions, while holding down Option + Shift then proceed to drag one of those corner boxes to make the image larger or smaller. 
  • Moving the Image: To adjust where on the screen your masked subject goes, hit the letter "V" (or hit Cmd + T) and then simply drag the image around. 

At it's most basic possible level, this is all there is to masking and this tutorial could theoretically end here. BUT...there's a whole bunch more that masking is used to do, like allowing you to further refine your composite image (i.e., blend it in to make it more realistic, which I did not do whatsoever here, and is why my "final result" currently looks terrible), and by letting you do things having nothing to do with creating a composite image.  

A few of these things are covered below...

(1) Filters: Say you wanted to apply a Gaussian Blur filter only to the trees to increase the bokeh effect.  To do that, you would create a new layer combing all your existing layers by hitting Shift + Option + Cmd + E.  Then go to Filter > Blur > Gaussian Blur and choose w/e you want. The entire image is now blurry.  Now, go to the bottom of the layers palette and select Add Layer Mask, just as we did allllll the way up top.  Using a black brush on the mask you can mask away all the areas you do not want to be blurry.  It's not that easy, but you get the point.  

(2) **Adjustment Layers** This is crazy important ----- Some people may not have the "Adjustment Layers" palette automatically appear on their screen as I do (left screenshot). If you don't you can do so by going into to the Window menu and selecting "Adjustments."  If you don't have it showing and don't care to have it showing all the time, you can always select an adjustment layer from the menu at the bottom of the layers palette (right screenshot). 

MASKING + ADJUSTMENT LAYERS

  • Local Adjustments to a Single ImageOne way masking & adjustment layers work together is if, for example, we were not dealing with a composite of multiple images -- as we have been with the elephant and iguana -- but we simply wanted to modify an aspect of a single image (say, my background iguana image), by darkening or brightening the grass, or changing the color of the grass to make it purple or whatever else your mind could think up, but without effecting any other aspect of the image besides the grass.  Going with the purple grass idea, you would select a Hue/Saturation adjustment layer, which would add the following layer to your layers palette (left) and this Properties box (right), where I will select Greens from the drop down menu so as to adjust only the greens. 

 

Moving the Hue slider all the way to the left produced the result below, where the iguana itself is now purple, as are the trees, and the sky and water now also have a slightly blue-ish hue: 

By selecting the white layer mask on the Hue/Saturation adjustment layer in the layers palette and painting with a black brush on the iguana, trees, sky and water, you get this result (how Grateful Dead of me): 

This same technique could be used with any of the adjustment layers and in SO many ways that it would be ridiculous for me to even start listing them.  Exploring all the adjustment layers is the best way to learn....

  • Blending Images Using Adjustment LayersA second use is to blend two images (as I've been doing with this elephant/iguana) and to make it look realistic using various adjustment layers (which I have not done at all).....

    For example, the elephant in my image is quite a bit darker than the underlying iguana image.  To fix this this, with your top layer selected (for me, the elephant layer), select a Curves adjustment layer, which will bring up a properties box as seen below and will also add a Curves Adjustment Layer to your layers palette just like the hue/saturation one shown in the screenshot above.  I included that arrow in the screenshot below to tell you about a cool feature that allows you to apply a given adjustment to only the layer immediately below the adjustment layer (for me, the elephant).  If you use this, you won't necessarily need to mask anything because you would only be brightening the elephant.  If you only wanted to brighten one part of the elephant or something you could still mask out the other parts, but otherwise it could be left alone.  If you don't choose to use this feature, then your given adjustment will be applied globally, in which case you will need to brush out the parts of the image that are now too bright.  

 

WORKING WITH INVERTED MASKED: This is also a good place to discuss painting on an inverted mask, which I touched on above.  In the case of the global curves adjustment I just talked about, the entire image became overexposed by my adjustment, as I said.  To save yourself (read: myself) quite a bit of work by needing to paint out the entire image with a black brush (except for the relatively small elephant), after working with your curves adjustment go back over and select the adjustment mask box in the layers palette and, as we did before, click Cmd + I to invert the layer mask, turning it black (see below).  The image will now go from being too bright everywhere, to being just as it was without any curves adjustment at all.  The layers palette should look like this:

Now, instead of using a black brush, hit "X" to switch the foreground color from black > white.  Using the white brush, you can simply paint directly onto the small area you want to adjust (for me, the elephant) and the effect of the adjustment layer (whatever it may be, but for me, the curves adjustment), will magically appear, leaving the remaining part of the image untouched.  Your adjustment mask should now look exactly the same as the other mask directly below it.

 

FINAL NOTE ON "NON-DESTRUCTIVE" EDITING: One of the major reasons why making is so useful is that it allows you to make edits in a non-destructive manner, meaning you can always go back and change your edit.  You could've used the eraser tool to isolate the elephant, but after like 4 clicks of the mouse you wouldn't be able to go back and change anything anymore...not the case with masking.  You'd simply need to hit "X" to paint with the opposite color (black or white) to fix your mistake. Virtually everything done in Photoshop can be done using a mask, so you could edit for hours and hours without worrying that at the 4th hour one mistake might ruin your last 3.9 hours of work. 

Thanks for reading!  If you found this helpful please let me know in the comments!

- Alex


Comments

No comments posted.
Loading...

Archive
January (1) February (1) March April May June July August September October November December
January February March April May June July August September October November December
January February March April May June July August September October November December