Masking and masking methods in Photoshop
16th Nov 2016 19:02:36 - ( 0 Comments) Author: supak0ma - Level: Beginner |
Masking can be considered the most useful skill in a photoshopper's trick book. In fact, it is a necessary skill to be mastered. |
Before heading deeper into how to use masks to your advantage, let's try and understand what a mask is: a mask is something which is used to hide or show certains portions of an image or of a layer. More simply put, imagine cutting out a picture of a fruit out of a magazine page with scissors. Now you are left with a page with a hole in it in the shape of the fruit. Now imagine if you could, and you can in Photoshop, trace the contour of the fruit and hide all that's around it. You'd end up with the magazine page intact, with no physical holes, with the fruit nicely countoured and isolated, sorrounded by a transparent sheet. The advantage lies within the fact that with this method you can retain the portions of the page that were hidden, or made transparent, for later use. This type of mask is called layer mask. Clipping masks serve a different purpose and we will dwelve into it further down the line.
Layer masks are probably the most commonly used and they can be of two types: pixel based masks and vector masks. Vector masks are applied by creating a path with the pen tool or the shapes tool and offer the advantage of a higher rate of precision of the mask's edge and of course scalability as vector objects are size independent, while pixel masks aren't, we all know what happens when we try to enlarge a picture, the image starts getting more blurry the more you enlarge it. In turn, pixel mask offer more control over the shape of the mask as they can be altered by using a brush, to alter a vector mask you need too edit its path.
There is one fundamental concept to understand when learning about masking: 100% white means 100% opacity while 100% black means 0% opacity (or 100% transparency). In between are all the shades of grey that represent different amounts of opacity (or transparency).
Let's view this example: open an image and in the layers panel, double click the background layer in order to unlock it. Still in the layers panel, with the layer selected, click on the icon representing a rectangle with a circle in it, located at the bottom of the panel.
You will see that near the small preview of your layer a white rectangle has appeared, with a small chain icon in the middle. This layer has now been linked with a layer mask.
Now select the brush tool from the toolbar panel, any kind of brush tip will do for this example, open the brushes panel (window>brush) and pick a brush tip.
Press “D” to reset the colour palette to default black/whte, make sure black is the foreground colour (press “X” to switch between foreground/background colour).
Check if the layer mask is selected, you can switch between layer and layer mask by clicking on the miniature in the layers panel.
Now start painting with your brush, you will see that wherever you pass with the brush, the image disappears, leaving the application background visible.
Now press X to have white as foreground colour, try brushing some strokes where you previously painted black, the image reappears in the areas you had previously hid.
Now try painting with different shades of grey, you'll notice that the darker the shade, the more transparent the image becomes, and vice-versa.
There are several methods to create a layer mask, they differ in the final result, they can also be combined to obtain a more precise outcome. Let's see in detail what some of the most popular methods are, remember that in Photoshop there are often multiple ways to achieve the same result, so it is up to you and your “style” and preference which ones you will use the most.
Probably the most used, it yelds a sharp, clear outline, due to its vector nature. The pen tool utilizes Bezier curves, which is a method of connecting points to draw a line on a computer utilising mathematical formulaes. Don't worry, all the maths are done by Photoshop, you only need to draw your shape. This method is the best when we need to cutout a sharp, in focus shape out of a picture. For our example we will use a picture of a car, choose one that is well defined in its contours.
Select the pen tool from the tools panel:
Click on the edge of the car, a new path will be created, now move along the car's contour and click and hold to add another point to the path. If you wish to creae a straight line, just click and don't hold. While holding the mouse button down, try moving the mouse in different directions, you'll notice the line you've just created bends and curves. You'll also notice that two “handles” have appeared, originating from the point.
Move the mouse until you are satisfied with the result, if you happen to release the mouse before you're done, hover with the cursors on one of the handles endpoints and while pressing CTRL, click on it and hold + drag to start moving it again. Now press ALT and click on the point you've just created, one of the handles disappears, we've just created a vertex point. This affects the shape of the line as we add another point to the path.
If we did not convert this point to a vertex, something like this would happen when we add the next point:
While this could be useful in some situations, it doesn't do here, we need a gentle curve from our point to the next one.
Now keep moving along the car's shape adding more points, make sure your path line splits the edge's pixels in half, zoom in and out (CTRL+SPACE then click and hold then drag left to right) on different detailed sections of the contour:
When you are done contouring the whole car, close the path by clicking on the first point we've created.
Zoom out, you'll see the path sorrounding the car, a thin grey line.
Now move to the layers panel, select the layer mask by clicking on its miniature then click on the little rubbish bin to delete it, in the confirm dialog box click on delete.
While pressing down CTRL, click on the path layer just above the car layer:
You'll notice the path turns into a selection (the little marching ants):
Now with the car layer selected, press the “add layer mask” button:
A new layer mask is created, with the shape of the car filled in white (visible) and everything around it in black (invisible).
That is it! Now the car is nicely cut out with a sharp contour:
Try and paint some white on the layer mask where it's black, you'll notice the image surrounding the car is still there but just hidden to view, this is very useful when you want to refine your edge. Never use the eraser again!
With the car nicely cut out you can place it on other images, such as your driveway:
This image is far from finished as it needs all sorts of adjustments, shading and light corrections, but those are topics for a different tutorial.
Click on the quick mask button, located on the bottom of the tools panel.
Select a painting tool, such as a brush. Make sure black is the foreground color then press CTRL+Backspace to fill the layer with black (use CTRL+Enter to fill with backgroud color). You'll notice the image has been covered in transparent red.
Press X to invert the swatch colours and start painting the apple, you'll notice the red colour disappears in the areas where you have painted.
Keep going until you have the apple cleared of the red, zoom in and use a softer brush to do the edges.
You can rotate the canvas by pressing R, then click and hold left mouse button, drag left-right, choose a position confortable to use the brush in, this is the equivalent of rotating a sheet of paper when you are drawing of writing, so that your hand is in a more confortable position, thus can be more precise. When you've found the correct position press B to select the brush tool again. If you make a mistake, just select black as foreground colour and go over the mistake with the brush.
Once you are done, click the Quick mask button again to exit the quick mask mode. You'll notice the apple is sorrounded by a selection.
Click on the new layer mask button in the layers panel to add this mask to our apple layer.
This is a quick and dirty way of making a selection by addressing a specific colour or colours in an image, works best with images with highly contrasting colours, take this landscape image, the sky is clear blues, rest of the picture is greens and sandy tones.
From the “Select” menu, click on “color range”, an options panel will appear.
Outside of this panel the cursor will beocme an eyedropper tool, with it click on a point in the sky in the upper left corner, you'll notice the preview image in the panel has changed, now displaying in white the the tone of blue you have selected.
In this case the colour white in the preview shows the areas that will be selected, while black areas won't be selected. Now while pressing SHIFT, click with the eyedropper on relative areas of the sky that are not completely white in the preview, this will add a new tone of blue to your selection, keep adding until you are satisfied, you can subtract a tone by pressing ALT and clicking on that tone. Play with the “Fuzziness” slider to refine the selection.
Press Ok when you're done and the selection is displayed on your image.
Now from the “select” menu click on “Refine edge...” then move the “Shift edge” slider to the left, to contract the edge a bit as it still contains some blue from the sky.
Click Ok. Invert the selection (CTRL+SHIFT+I) then press the new layer mask button in the layers panel. You'll notice there are some areas that were not supposed to be masked in the vegetation, we can fix this by painting these area white on the layer mask.
As previously stated, this method doesn't yeld the most precise results, but it is very quick. We can proceed to add a sunset sky behind the vegetation.
You can use this method with different tools, such as the marquee tool, lasso tool and magic wand tool.
Well, that is it for this tutorial, there are more complex methods to achieve more complex selections, like hair or fur, that will be covered by a different tutorial.
Layer masks
Layer masks are probably the most commonly used and they can be of two types: pixel based masks and vector masks. Vector masks are applied by creating a path with the pen tool or the shapes tool and offer the advantage of a higher rate of precision of the mask's edge and of course scalability as vector objects are size independent, while pixel masks aren't, we all know what happens when we try to enlarge a picture, the image starts getting more blurry the more you enlarge it. In turn, pixel mask offer more control over the shape of the mask as they can be altered by using a brush, to alter a vector mask you need too edit its path.
There is one fundamental concept to understand when learning about masking: 100% white means 100% opacity while 100% black means 0% opacity (or 100% transparency). In between are all the shades of grey that represent different amounts of opacity (or transparency).
Let's view this example: open an image and in the layers panel, double click the background layer in order to unlock it. Still in the layers panel, with the layer selected, click on the icon representing a rectangle with a circle in it, located at the bottom of the panel.
You will see that near the small preview of your layer a white rectangle has appeared, with a small chain icon in the middle. This layer has now been linked with a layer mask.
Now select the brush tool from the toolbar panel, any kind of brush tip will do for this example, open the brushes panel (window>brush) and pick a brush tip.
Press “D” to reset the colour palette to default black/whte, make sure black is the foreground colour (press “X” to switch between foreground/background colour).
Check if the layer mask is selected, you can switch between layer and layer mask by clicking on the miniature in the layers panel.
Now start painting with your brush, you will see that wherever you pass with the brush, the image disappears, leaving the application background visible.
Now press X to have white as foreground colour, try brushing some strokes where you previously painted black, the image reappears in the areas you had previously hid.
Now try painting with different shades of grey, you'll notice that the darker the shade, the more transparent the image becomes, and vice-versa.
There are several methods to create a layer mask, they differ in the final result, they can also be combined to obtain a more precise outcome. Let's see in detail what some of the most popular methods are, remember that in Photoshop there are often multiple ways to achieve the same result, so it is up to you and your “style” and preference which ones you will use the most.
The pen tool
Probably the most used, it yelds a sharp, clear outline, due to its vector nature. The pen tool utilizes Bezier curves, which is a method of connecting points to draw a line on a computer utilising mathematical formulaes. Don't worry, all the maths are done by Photoshop, you only need to draw your shape. This method is the best when we need to cutout a sharp, in focus shape out of a picture. For our example we will use a picture of a car, choose one that is well defined in its contours.
Select the pen tool from the tools panel:
Click on the edge of the car, a new path will be created, now move along the car's contour and click and hold to add another point to the path. If you wish to creae a straight line, just click and don't hold. While holding the mouse button down, try moving the mouse in different directions, you'll notice the line you've just created bends and curves. You'll also notice that two “handles” have appeared, originating from the point.
Move the mouse until you are satisfied with the result, if you happen to release the mouse before you're done, hover with the cursors on one of the handles endpoints and while pressing CTRL, click on it and hold + drag to start moving it again. Now press ALT and click on the point you've just created, one of the handles disappears, we've just created a vertex point. This affects the shape of the line as we add another point to the path.
If we did not convert this point to a vertex, something like this would happen when we add the next point:
While this could be useful in some situations, it doesn't do here, we need a gentle curve from our point to the next one.
Now keep moving along the car's shape adding more points, make sure your path line splits the edge's pixels in half, zoom in and out (CTRL+SPACE then click and hold then drag left to right) on different detailed sections of the contour:
When you are done contouring the whole car, close the path by clicking on the first point we've created.
Zoom out, you'll see the path sorrounding the car, a thin grey line.
Now move to the layers panel, select the layer mask by clicking on its miniature then click on the little rubbish bin to delete it, in the confirm dialog box click on delete.
While pressing down CTRL, click on the path layer just above the car layer:
You'll notice the path turns into a selection (the little marching ants):
Now with the car layer selected, press the “add layer mask” button:
A new layer mask is created, with the shape of the car filled in white (visible) and everything around it in black (invisible).
That is it! Now the car is nicely cut out with a sharp contour:
Try and paint some white on the layer mask where it's black, you'll notice the image surrounding the car is still there but just hidden to view, this is very useful when you want to refine your edge. Never use the eraser again!
With the car nicely cut out you can place it on other images, such as your driveway:
This image is far from finished as it needs all sorts of adjustments, shading and light corrections, but those are topics for a different tutorial.
The quick mask tool
The quick mask tool lets you paint the areas you want to mask, using any painting tool. You can either add to the mask, by painting with black (displayed as a 50% red overlay), or subtract, by painting white (transparent portions of the image). Any shade of grey in between yelds a feathered, semi transparent selection. Open an image of an object with not so well defined contours, for example this image of an apple.Click on the quick mask button, located on the bottom of the tools panel.
Select a painting tool, such as a brush. Make sure black is the foreground color then press CTRL+Backspace to fill the layer with black (use CTRL+Enter to fill with backgroud color). You'll notice the image has been covered in transparent red.
Press X to invert the swatch colours and start painting the apple, you'll notice the red colour disappears in the areas where you have painted.
Keep going until you have the apple cleared of the red, zoom in and use a softer brush to do the edges.
You can rotate the canvas by pressing R, then click and hold left mouse button, drag left-right, choose a position confortable to use the brush in, this is the equivalent of rotating a sheet of paper when you are drawing of writing, so that your hand is in a more confortable position, thus can be more precise. When you've found the correct position press B to select the brush tool again. If you make a mistake, just select black as foreground colour and go over the mistake with the brush.
Once you are done, click the Quick mask button again to exit the quick mask mode. You'll notice the apple is sorrounded by a selection.
Click on the new layer mask button in the layers panel to add this mask to our apple layer.
Create a mask with a painting tool
By following the logic applied in the two methods above, you can also draw a mask with any painting tool, click on the new layer mask button in the layers panel and start drawing the mask, remember, the layer mask must be selected and black where you want to hide, white where you want to show.Mask by selection
There are various methods to obtain a selection in Photoshop, and with it, create a layer mask. Each one applies to a specific situation. We're going to use the “Color range” method for this example.This is a quick and dirty way of making a selection by addressing a specific colour or colours in an image, works best with images with highly contrasting colours, take this landscape image, the sky is clear blues, rest of the picture is greens and sandy tones.
From the “Select” menu, click on “color range”, an options panel will appear.
Outside of this panel the cursor will beocme an eyedropper tool, with it click on a point in the sky in the upper left corner, you'll notice the preview image in the panel has changed, now displaying in white the the tone of blue you have selected.
In this case the colour white in the preview shows the areas that will be selected, while black areas won't be selected. Now while pressing SHIFT, click with the eyedropper on relative areas of the sky that are not completely white in the preview, this will add a new tone of blue to your selection, keep adding until you are satisfied, you can subtract a tone by pressing ALT and clicking on that tone. Play with the “Fuzziness” slider to refine the selection.
Press Ok when you're done and the selection is displayed on your image.
Now from the “select” menu click on “Refine edge...” then move the “Shift edge” slider to the left, to contract the edge a bit as it still contains some blue from the sky.
Click Ok. Invert the selection (CTRL+SHIFT+I) then press the new layer mask button in the layers panel. You'll notice there are some areas that were not supposed to be masked in the vegetation, we can fix this by painting these area white on the layer mask.
As previously stated, this method doesn't yeld the most precise results, but it is very quick. We can proceed to add a sunset sky behind the vegetation.
You can use this method with different tools, such as the marquee tool, lasso tool and magic wand tool.
Well, that is it for this tutorial, there are more complex methods to achieve more complex selections, like hair or fur, that will be covered by a different tutorial.
Comments
No comments have been posted yet.