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.
(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.
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:
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
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....
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