SEARCH

How-To Geek

How To Use Layer Masks and Vector Masks to Remove Complex Backgrounds in Photoshop

sshot-449

Ever removed a background in Photoshop, only to find want to use parts of that background later? Layer Masks and Vector Masks are the elegant and often misunderstood answer to this common problem. Keep reading to see how they work.

In this article, we’ll learn exactly what a Layer Mask is, and two methods to use them in practically any version of Photoshop, including a simpler example for less experienced Photoshop users, and another for more seasoned users who are comfortable with the Pen tool and vectors.

What is a Layer Mask?

Image Mask Demo

Layer Masks, put simply, are like a hidden layer that tells Photoshop where to “hide” the information in your chosen layer. To be more exact, it’s an “alpha channel” used to mask out the image information you want to hide. Because this information is in another channel separate from the image in your layer, you can revert to your original, unmasked layer at any time. As you can imagine, many Photoshop users prefer Layer Masks to simply deleting information with the eraser tool.

The Simple Method: How To Use Layer Masks

sshot-451

Start with an image appropriate for background removal. This image and hundreds like it are available on Wikipedia under Wikipedia Pictures of the Day. Simply use your own if you have photographs you wish to mask.

sshot-453

Make a copy of your background layer by right clicking on it in your Layers Panel. By default, it will rename your new layer to “Background copy.” For nearly all situations, this is fine. Click OK.

sshot-454 sshot-455

Click the hide layer to hide your original Background layer as shown on the above left.

You can then click the mask icon to create the blank mask on your layer. Make sure your layers panel looks like the image on the right to ensure your have a blank mask ready and selected and your background layer successfully turned off.

sshot-458

Press b to select the Brush Tool. Right click somewhere in your image to adjust your brush hardness and size. The default “Hard Round” brush is a good setting for this, as well. Otherwise, note the 100% Hardness setting shown above.

sshot-459 Hint: Check your Foreground/Background colors before you do anything. You’re going to want to paint with a foreground color of black and keep a background color of white. You can always press “d” on your keyboard to ensure you revert to the proper 100% black and pure white.

sshot-460

Simply paint into your new mask, and all areas you paint over will vanish, masked away to the background.

sshot-467sshot-466

Exactly how is this different than using the Eraser tool? Masks, as stated earlier, can be turned off or deleted, allowing users to return to their original image.

sshot-468

Simply right click on the mask you’re working in in your layers panel. You’ll be given this contextual menu, where you can “Disable” your layer mask, delete it, or “Apply” it, which uses the mask you’ve painted to delete your masked information.

sshot-481

Beyond that, painting out your information with layer masks is no more complex than using the Eraser tool. Carefully paint around your object to remove it.

sshot-482

It helps to start with the most difficult areas closest to your object before removing the bulk of your image.

sshot-483

Once your most difficult areas are finished, you can use a larger brush to mask out the areas you don’t want.

sshot-484

Voila, your image is complete and masked for use anywhere you please. Not satisfied? Here’s an advanced method using vector masks.

Using Vector Masks to Remove Backgrounds

sshot-479

If you’ve never used vectors or the pen tool in Photoshop, this is going to be a frustrating how to for you. Less seasoned readers may want to learn about the difference between Vectors and Pixels, or brush up on the Pen tool before going forward.

sshot-470

Vector masks are not very different from Layer Masks, except that they use vector primitives to create their Alpha mask channels. To create these vector primitives, we’ll have to use the Pen tool to create a work path we can mask our layer with. Start by creating a copy of your background, as done in the previous method.

sshot-473

Press p to select the Pen tool. Simply draw your shapes around your object as best as you can. Keep to the outside perimeter and ignore any shapes inside the object for now.

sshot-474

Don’t worry about getting every blurry pixel into your work path. Since you’re creating masks and not deleting information, you can consider less to be more. It’s more important to draw vectors that represent the object well—not ones that capture every smeary pixel.

sshot-475

Trace the entire object around and connect your last point to your first one to create an enclosed object. This is absolutely important and vital to the next steps, where we’ll add the holes and gaps within the object.

sshot-476

If your work path is complete and connected to itself as a complete, contiguous shape, you can draw in the little fiddly shapes and gaps that pop up inside the object without problems.

sshot-477

Draw in all the shapes inside the object in the same work path. You should have handsome vector lines around your object similar to these.

sshot-478

Navigate to Layer > Vector Mask > Current Path to create a Vector Mask from your current Work Path. Your active work path will become a Vector mask, and remove the background from your object with no additional steps!

sshot-485

From there, you can do any absurd thing to your image you care to, changing backgrounds and scaling your vector object to all manner of ridiculous sizes. Have fun working with layer masks and removing those complex backgrounds!


Have questions about Photoshop? Contact the author at ericgoodnight@howtogeek.com with all your Photoshop and Graphics Geek needs. You never know when your question could be featured as the next great HTG article.

Image Credits: Citrus Swallowtail by Muhammad Mahdi Karim, released under GNU License. Black Phoebe by Matthew Field, released under GNU License. Image of Andromeda Galaxy is in the public domain, created by NASA .

Eric Z Goodnight is an Illustrator and Graphics Geek who hopes to make Photoshop more accessible to How-To Geek readers. When he’s not headbanging to heavy metal or geeking out over manga, he’s often off screen printing T-Shirts.

  • Published 01/17/11

Comments (6)

  1. Hatryst

    I think this is the MOST WIDELY USED method for selection of objects…
    (out of the other 10 or 20 methods !)

  2. Matt

    Why would you not use the quick selection tool, then refine edge? I think you could make you selection much faster. That’s just my two cents though.

  3. Irfan

    Thanks a lot
    but sir it method to be slowly

  4. Grant

    @Matt that works in most cases (and is actually what i typically use), but i can see how u might want to use this method if the quick selection tool doesn’t work

  5. pyro226

    Here’s how to use the paths tool in Gimp to do the same as the pen tool in Photoshop. (Like the article, you should first duplicate the layer and turn off the visibility of the original image). First, select everything that you want using the pen tool. (To close the shape, you will need to hold control key to connect the last point to the beginning point.) Press enter to select “path to selection” (select everything within the drawn vectors). Now the part of the image is selected. Go to layer>mask>add layer mask. Select “Selection”. Now apply the layer mask by going to layer>mask>apply layer mask. You now have the selected part of the image with a transparent background.

  6. PACKER-Gforce

    @pyro226 your the man, thanks for posting the GIMP-equivalent instructions! I been just startin to wrap my mind around this whole concept of masks & that was really helpful.

Enter Your Email Here to Get Access for Free:

Go check your email!