Thursday, July 10, 2014

Tutorial: Extracting Objects from Backgrounds

by CT member - Nancy aka physioscrapper

A way to add extra interest to your page OR get rid of a background that you don't want is to Extract your image from the photo.  I'm going to outline 4 different ways that it can be done, then you can choose what technique best fits you, or fits the type of photo you are using.

This tutorial is primarily for PSE and Photoshop, but the first technique will work with almost any photo editing program. Any time the instructions are in a different color this signifies a tip or trick for use with PSE or PS.

First a quick review of where the different tools we will be using throughout the different tutorials are.
This is CS5 - in PSE the tool may be in a different spot, but the image is the same.
We will be using a picture of my 3 yr old granddaughter in her dance costume as an example.

1.  The Eraser Tool method:
Although this may be the easiest way to get started extracting your object, it is also the most unforgiving. If you make a mistake you either have to recognize it right away to "undo" your error, or start over.
If you are capable of doing any of the other methods I'm going to list below, please do.

With this method, you simply take your photo. Make a copy of it (Control - J duplicates your image).
Hide the original image, by clicking on the eye beside the original photo or background layer.
Go to the eraser tool.
Start with a large eraser if you have a lot of background to erase (150 to 200 px in size)
Hardness ~ 90 % to 100%, and begin to erase the background.

Once you got the main part of the background erased,  zoom in up close so you can see the edges.
Zooming in:  There are 3 ways to zoom in so you can see the details of your picture.
  1.  Use the magnifying glassFound with all the tools, usually close to the bottom.Once selected, click several times over the spot you want to see better.
  2.  Hold down Cntl/ Com (on a Mac) and at the same time hit the "+" key several times to enlarge your picture.  To decrease in size: Hold down Cntl/Com and hit the " - " key.
3.  If you have a wheel on your mouse, you can set in preferences that scrolling with your mouse wheel will zoom in or out.  Edit the preferences by going to:
Edit (at the top of your page), then move all the way down to Preferences, General, then make sure 
"Zoom with scroll wheel" is checked. 
**While zoomed in, to quickly move your selection, hold down the space bar- a hand will appear. Left click your mouse and while holding it and the space bar down, move your mouse in the direction you wish to shift your image.
After zooming in to see the edges, change your eraser size so that it is smaller and you can make a better selection of the edges.
Shortcut to change Eraser or Brush Size:  
Ctrl/Com + [  (left bracket key) decreases the size
Ctrl/Com + ]  (right bracket key) increases the size

 A little bit of a blurred edge will just allow the photo to blend into the background paper better and look more realistic, so you can keep your eraser at 90% hardness.
Very carefully erase slowly around the outside of your subject.
Sometimes it helps to place a paper under your layer so you can see the edge easier, and see what you missed erasing.
Continue around the entire object erasing the background.  At the end you should have your extracted person on a separate layer, with a transparent area all around it.  In the image above I have erased around the legs and feet and would continue around the entire body.
Once the background is completely erased, put any layers you don't need in the trash can.
Move this picture layer onto your layout page.
(See shadowing) at the end of this tutorial to complete your page.

2. Using a Mask Method:
Later versions of PSE and all versions of PhotoShop have the capability of masking.
See the first illustration above to see what the mask icon looks like.

  • To start: Duplicate your image (Ctrl/ Com + J)  or  Layer --> Duplicate Layer.
  • Hide the original image, by clicking on the eye in the layers palette.
  • Highlight the copied layer (Layer 1), then click on the mask icon.
  • Highlight the BRUSH tool, use a semi-soft brush - 90% hardness and about 200 pixels in size to start.
  • Make sure your color chips are set to black and white, by clicking on "D".  You want black to be the foreground or top color...if it isn't hit the "X".

The beauty of masks is that it is a non-destructive and very forgiving way to erase the background.
When we paint on masks... Black will make your background layer disappear.  White will bring it back. (Black conceals, White reveals).
  • Click directly on the white mask (on your picture layer) to select it.
  • Using a brush with black color selected, paint/brush directly on the photograph and you will see the background disappear and transparent pixels will remain.
  • (If you see black directly on the photo, stop immediately, Ctrl/Com 'Z' to undo, and make sure you have clicked on the white mask beside the picture)
  • (If nothing happens when you start painting on the picture, check to make sure your color chips didn't get changed around.  You want BLACK as your foreground color like in the picture above. OR: make sure your original photo (the background layer) is hid.- click on the eye to turn off.)
Below I've started with the large brush to remove the background.  You can see the transparent pixels in the photo, and on the mask the black paint of what has been removed.
  • To see what you have to erase easier, I often put a colored paper as a layer below the image I'm masking away so I can get close edges.
Make a mistake and erase too much?  No problem!  Just change your brush foreground color to white and paint again on the photo and the picture will be revealed again.  (Again, make sure you have the mask highlighted and chosen)
  • Zoom in close and decrease the size of your brush to get the edge details.  I often zoom until the picture is 200 to 300%  bigger and my brush size is 5 pixels in size to get the detail of what I'm extracting.
See above for shortcut tips on Zooming and changing your brush size.
  • Continue around the entire object painting black to remove the background.  At the end you should have your extracted person on a separate layer, with a transparent area all around it.
    When the background is completely erased, Put any lower layers you don't need in the trash can.
  • Highlight the MASK. Right click and from the drop down menu that appears chose APPLY MASK.  This will leave your extracted image all ready to be placed on your layout page.
    (See shadowing) at the end of this tutorial to complete your page.
    3. Extracting using the Magnetic Lasso tool.
    The magnetic lasso tool is found with the lasso tool.  Right click on the lasso tool and a drop down menu will appear.  Choose Magnetic lasso.
    At the top, make sure the second box is highlighted (Add to selection), Feather - 2 px, Width: 5 px, Contrast - start at 15% but this may have to be adjusted.
    (If the lasso doesn't pick up the edge increase the contrast, if it is making too much of a selection you may have to decrease the contrast.)
    • Once your tool is prepared, start anywhere on the edge of the image you wish to extract and slowly drag your mouse around the edge. This tool acts like a magnet leaving a line trail that sticks to the edge of your image you wish to extract. It will leave little points of contact.  If you get a point that you DON'T want, hit BACKSPACE and the last point will disappear.
    • Continue all the way around until you are back where you started. When the finishing point/ line is connected with the beginning point, marching ants will appear around your selection. At the image below I am just about to connect up my lines.
  • On areas of curve, left click your mouse to put down a points of contact within short distances. Points very close together will give the straight lines a curve.
  •  Zoom in (enlarge your picture) to get accurate magnetic point placement. Use the hand tool (by holding down the space bar) to move your picture.
  • This tool works best on pictures with high contrast, but can be used with lower contrast ones, you just have to manually put down more points along the way, instead of the tool automatically selecting the edge and drawing a line around it.

    Once you have the marching ants around your selection, select your image from the background by using the shortcut keys:  Ctrl/Com + 'J'  or go up to the top menu bar and select:
    Layer --> New ---> Layer via copy
    and you selection will appear on its own separate layer. (Below it looks like nothing has happened, but if you look in the layers panel, you'll see you now have 3 images... the top (Layer 2) is the extracted one with a pixelated background, the middle is the one we just worked with, and the bottom layer is the hidden original).
    At this point you can hide Layer 1 (the middle layer) by clicking on the eye (the image you just finished using with the tool) and you will see your selection with a pixelated background.
    • Next take the magnetic lasso again and do the individual areas between the arm and skirt, & between the legs.  After each selection just hit delete to remove the area.
    • OR:  add a mask and using a black brush mask out the areas between the arms and skirt.
    • OR: grab the eraser and erase the areas between the arms/skirt.
    •  When the entire background is erased, I SAVE this first as a psd file (so I can go back for reference or if I want to fine tune it a touch more).
    • Then you can immediately use / move your extracted image layer (Layer 2) onto your layout page.  If you want to save this extracted image, save the image layer only as a .png file. (This keeps the transparent background.  If you saved it as a jpeg it would refill the transparent areas with white.)

    4. Extracting using the Quick Selection tool. (Photoshop Only)
  • Nestled with the Magic Wand tool is the Quick Selection tool in Photoshop.
  • Choose this tool, make sure the second box (add to selection is checked) Pick a brush size - which depends on the size of your image in the picture.( If it isn't a smooth selection a smaller brush will be necessary.) Make sure 'sample all layers' and 'auto-enhance' ARE checked.

  • Start by putting your cursor in the center of the image you wish to extract. With this tool you will be making a selection from the inside out.
  • Hold down the left button of your mouse and push the selection lines out to the edges of the image you wish to extract by moving your brush toward the edges.
    • You can subtract from the selection by choosing the 3rd box at the top, OR by holding down the ALT key.  In this image the area between her arms and skirt will need to be subtracted, as well as the extra white space by her neck on the left.
      • Change the brush size at any time by using the Bracket keys. [ = smaller;  ] = larger.
        Once the entire selection is made, we can smooth out the edges by using... 
      • REFINE EDGE... click on that button (found beside auto enhance in the toolbar on top). This box will appear.  Use these settings to start.


      •  You can smooth the edges and gain back areas which the magic selection tool may have erased by using this nifty tool. With the brush selected in the Refine Edge menu, brush over any edge that you think should be slightly different.  I did the ears, the hair on top, tulle on the skirt and sleeves, and the slippers.  It will add a bit of edge then magically subtract it to where the edge 'should' be.  If it didn't get it right the first time, just brush over the area again. It allowed the strands of hair to be seen in her bun at the top.
        Note I have the final image going on a separate layer.  There are several choices from that drop down menu.  Click okay when you are satisfied with the picture.

        Using & Shadowing Your Extracted Image

        -Move your extracted image layer onto your page. One of the final things that makes or breaks an extracted image is the shadow.
        -It is extremely important to check your light source on your photo and adjust the angle of the drop shadow as well.
        -On this picture the light is coming from our upper left so I chose to start a drop shadow of 125ยบ. You can tell because of the light on her face.
        - Apply a large dropshadow (as this is a large object).
        **Note in the picture below the 'standard' drop shadow can also be seen below her feet.  If you were normally shadowing an element this may be fine, but with the realism of extracted images it must be changed as it would be impossible in real life unless she was jumping.
        - IN PHOTOSHOP:  Right click on the dropshadow fx and chose CREATE LAYER.  This will put your shadow on a separate layer, where you can manipulate it.  I use the SMUDGE TOOL to push my shadow where I want it.
        In PSE you either have to make your own shadow layer, or just erase under the feet the "extra shadow".
        In the photo below, I have used the smudge tool and corrected the shadow under one foot. Also note that the shadow is a large shadow, for a person standing in front of paper would produce a large fairly soft shadow behind.
        I changed the paper, added some elements under the image layer to give the page more dimension and now have a neat finished mini-page of my granddaughter.
        Kit used:  ISO - Peace Within by Created by Jill.
        Have fun playing and trying some of these methods to extract your image from your photo.



  1. Thanks a bunch for the great tutorial!

  2. very nice tutorial. thanks for sharing

  3. Thanks for this tutorial, it is was very interesting especially for the beginners like me. However I want add that to do things like this on MAC you should use next one photo .It is very helpful and easy in use photo editor.