How to select and remove the background
of photos of dahlia flowers

NOTE: The start of this exercise explains the principles and tools used to make selections and use them. The actual assignment is further down.

What is a selection?

Selecting in Photoshop (and most other graphics software) is the process of isolating an area of an image so that it can be:

Being able to make proper selections is one of the most important skills to have when using Photoshop.

The math behind a selection and how it is applied

I am counting on you to stay awake as you read this!

You probably learned in mathematics that any value multiplied by 0 (zero) results in 0 (zero). Also that any value multiplied by 1 remains the same. And any value multiplied by a decimal fraction, such as 0.5, will result in only part of the original value remaining. For example: 30 x 0.5 = 15

The color image and the selection are essentially two separate matrices of pixels both having the same amount of pixels, rows, and columns. One matrix stores individual red, green, and blue (RGB) values for each pixel (the image). The pixels of the other matrix contain numerical values in the range of 0 (zero) to 1.

These can then be multiplied by each of the corresponding color pixels.

The multiplier values in a selection also can be represented as a gray scale image. That image is called a mask. Photoshop selections and masks are almost synonymous, they only look different.

The gray scale mask represents a multiplier of 1 as white. Black represents a multiplier value of 0 (zero). Fractional decimal values are represented by grays. For example, a dark gray mask pixel would represent a low pixel multiplier value, such as 0.15

The gray scale image is intended to allow users to visualize the multiplier values, however it can potentially cause confusion. This is because people can easily consider a mask to be an image, but it is not an image, it only looks that way. It is, in fact, a representation of multiplier values from 0 (zero) to 1.

To further confuse the user, the gray scale mask can also be "painted" with a brush using black or white or any gray value in between. So it may seem as if it IS an image like a color photo.

You may wonder, what is the purpose of mask pixels that have a value between than 0 (zero) and 1? The values between 0 (zero) and 1 are decimal fractions that will make a color pixel partially transparent. The most important use of these semi-transparent pixels is to soften the edge of a selection. The edges determine how smoothly the edge of a selection is blended with an image or color behind it.

Capiche?

Are you still awake?

How to select pixels

Tips for viewing your work area

Methods of selecting

Selecting pixels in an image using Photoshop can be done using many different methods. Some include:

You can use a wide array of selection tools and menu options to make your selections. When making a selection you are not limited to using just one type of selection tool. You can use all of the selection tools below to work on the same selection in conjunction with other selection methods. It is often best to use more than one method for making a selection.

The selection tools from the Toolbar, showing the fly-out menu items

Click and hold on a tool icon to see the fly out menu that shows the other tools associated with it.

Marquee selection tools Lasso selection tools Object, Quick, & Magic Wand selection tools

Generally, I make selections using the options and tools in this order:

  1. Select > Subject
    1. This will work IF Photoshop thinks you HAVE a primary subject.
    2. If not, press Ctrl/⌘-D to delete an unsatisfactory starting selection.
  2. Then, use Shift or option/alt keys in conjunction with other tools to add or remove from your selection, as noted in the section below.
  3. I recommend continuing in this order to build on your selection:
    1. Quick Selection Tool - to select broad areas of the image if they are similar in color or look.
    2. Marquee tools can be used to select areas quickly but without refinement.
    3. Polygonal Lasso Tool - this allows you to "click-click-click" to create the points for a polygonal shape to be added or subtracted.
    4. The Quick Mask Mode where you can "paint" the selected area.
      1. Just press the Q key. Read on for the details.
      2. Don't confuse this with the Quick Selection tool.

Editing your selections

Tips and More about selections and masks

My comments about the selection options and other tips

Saving your selections

Selections can, at times, require a lot of time to complete. Therefore, it is a good idea to save your selection periodically as you build on it in the event of a crash or if you need to return to a prior saved version of it.

How to use the Quick Mask tool

  1. Press Q to enter Quick Mask Mode.
    1. If you have already made a selection, the area outside of it (the unselected area) will have a reddish overlay.
      1. The color of the overlay can be changed easily in the event that there is a preponderance of red in the color image thus making it difficult to see the extent of the mask. You can also adjust its opacity.
      2. See Quick Mask options
    2. As mentioned before, the overlay is also very good to use for checking an existing selection. You may want to periodically turn Quick Mask Mode on and off (use the Q key) to check the progress of your work on the selection.
    3. The selected layer in the Layers panel will also have a red tint.
  2. Press B to select the Brush tool.
  3. Tips for working with a brush (this applies to many other tools as well):
    1. To change the size of the brush, or soften the brush edges, use these keyboard shortcuts:
      1. To increase or decrease the brush size, hold down the left or right bracket key:
        1. left ( [ ) reduces the brush size.
        2. right ( ] ) increases the size.
        3. You will see the brush size represented by a circle that gets larger or smaller. Note that if the brush is very small or very large you will only see a plus ( + ) symbol. Hold down a bracket key until you see a circle appear.
      2. To create a softer or harder edge to the brush (for providing blending smoothness), Hold down the Shift key at the same time. You will see the circular shape of the brush change, but this time it represents the middle of the softness that you have set, if any.
  4. Press D on your keyboard to set the colors to Photoshop's default colors...
    1. Black for the foreground color and white for the background.
    2. Those terms are not very helpful in this context.
    3. It would be more useful to think of them as:
      1. black = subtract from selection (making it appear reddish)
      2. white = add to the selection, to make more of the color image visible.
  5. Note that as you paint, you will not actually be painting in black and white (b&w), or seeing the b&w colors that your brush is set use. You will actually be painting selected or unselected areas.
  6. Use your brush to paint or remove from the selection:
    1. The brush can be slow, be patient.
    2. Use black to remove from the selection (which adds to the red overlay).
    3. Use white to add to the selection (removes from the red overlay).
    4. Press the X key to quickly swap the b&w painting colors as needed.
    5. You can swap between Quick Mask Mode and the crawling ants of the selection by just pressing Q on the keyboard. I tend to do that a lot.
  7. Note that in Quick Mask Mode the only colors permitted for the brush are gray scale. If you pick an actual color from the color picker, Photoshop will convert it to its gray scale equivalent.

Your assignment

dahlia-A.jpg dahlia-B.jpg dahlia-C.jpg

Your assignment is to create and save a selection for each flower that clearly and precisely delineates the shape of the outer edge of the flower in each image. You will be graded on the accuracy of your selections.

  1. Download the three images above by right-clicking on them one at a time and selecting Save (or similar, depending on your browser).
  2. Open all of them in Photoshop.
  3. Use File > Save As... to save each jpg in the Photoshop format.
    1. This will allow you to manipulate the image.
  4. At the bottom of the Save As dialog box is a Format menu.
  5. Select Photoshop from the top of that menu.
  6. Use the jpg file's initial root name prepended by YOUR first name and a dash ( ), no spaces!
    1. For example, I would name my files:
      dan-dahlia-A.psd
      dan-dahlia-B.psd
      dan-dahlia-C.psd
    2. Use YOUR first name (doh!).
  7. In the Layers panel of each file, there will be only one layer, named: Background. It contains the flower image.
  8. Click on that layer to select it.
  9. Press Ctrl/⌘-J on your keyboard to duplicate that layer.
    1. I do this in order to keep the original image layer intact in the event that I need to revert to it.
    2. Now click on the eye icon on the left side of the Background layer to hide it and so as to avoid accidentally editing it.
    3. Double click on the name of the new layer, Layer 1, and change it to flower.
  10. Save each file periodically as you proceed.
  11. Now select the flower using the information in the section How to select pixels, above. I suggest you read it again before you proceed! I would start with Select > Subject
  12. As you develop your selection, press the Q key to toggle Quick Mask Mode. This will assist you in checking the accuracy of your selection.
  13. Regarding the dahlia-C image, please try isolate the central large dahlia and remove the additional purple flowers on the periphery.
  14. When you think your selection is correct, go to Layer > Layer Mask > Reveal Selection
    1. This creates a layer mask which will make transparent anything that was not selected.
    2. The transparent area is represented by a white and gray checkerboard, which is the standard representation in many graphics programs.
    3. A b&w thumbnail image of the layer mask will be displayed in the layer to the right of the color thumbnail.
      1. The white area represents pixel locations that have a multiplier values of 1.
      2. The black area represents multiplier values of 0 (zero).
      3. As mentioned previously, these values are then multiplied by the RGB values of each color pixel to determine the resulting image.
  15. Do the following as additional checks of the accuracy of your selection's mask:
    1. Alt/Option-click on the layer mask to load the mask image.
      1. Look for stray gray areas that ought to be black or white.
      2. You can paint them out with the brush tool (use the "X" shortcut key to switch between black & white colors)
    2. Also, add a solid color layer beneath the flower layer that has the transparency you added.
      1. Select the original Background layer at the bottom of your Layers panel.
      2. Then add a layer with a solid color, which will go above it:
        1. Layers > New Fill Layer > Solid Color >
        2. The Color option in the next step refers to applying a tint to that layer in the Layers panel, not the color of the new fill layer. Just click OK to proceed.
        3. Next, the Color Picker will appear so that you can select a suitable bg color.
          1. I assume you are already familiar with the use of the Color Picker.
          2. Specify a color that will be best for distinguishing the boundary of the edge of the flower. You will probably want to use a different color for each flower.
          3. For example, if you have a predominantly red flower, select its opposite, light blue.
          4. It is easy to change the color of the color layer. Double click on the color thumbnail at the left of the layer. This will open the Color Picker allowing you to change the color.
            • TIP!
              With the Color Picker open, move the little selection circle around in the color selection area and in the vertical spectrum bar. The background color will change simultaneously. This allows you to preview the accuracy of your mask with a variety of colors, tints, and shades. Terrific!
      3. Note that having this layer with a suitable contrasting color will be a part of your grade. Please leave it visible (have the color layer eye icon enabled).
  16. If you want to modify the layer mask, you need to load the selection from it back onto the image by right clicking on the layer mask icon and selecting Add mask to selection (this works even if there is no current selection). Or load it from the saved selections using Select > Load Selection
    1. You ought to see the shape of your mask displayed as a selected area with the characteristic crawling ants.
    2. Use the knowledge you have gained to improve on the selection.
    3. If you intend to replace the layer mask with your revised selection (you probably will), first remove the existing layer mask by right clicking on its thumbnail icon and selecting Delete Layer Mask.
    4. Then make a new layer mask from your improved selection by using the Add layer mask button at the bottom of the Layers panel.
  17. When you have a selection that you like, save it using the Select menu > Save Selection > Name > flower
    1. If you don't have a proper saved selection shown at the bottom of the Channels panel it will affect your grade.
  18. Save your Photoshop psd files: File > Save
  19. Put all three of the flower files into one folder (if they aren't already in one, with no other files in it).
    1. Name that folder
      yourfirstname-flower-selections
    2. ...and replace yourfirstname with YOUR first name (doh!).
    3. For example, I would name my folder:
      dan-flower-selections
  20. Zip that folder and upload it to the Canvas assignment.