Photoshop Tutorial - Extracting an Image

Here is where you will find plain-language instructions for how to use all of Femme Fatalities' features. Plus it is a place to post any tech questions you need answered. Computer-savvy members, please visit this forum regularly to see if there are any fellow members who need help.

Moderators: Moderators, Admin

Post Reply
User avatar
syncret
Posts: 44
Joined: Mon Feb 01, 2010 12:59 am
What is your main fetish?: Shooting fantasies primarily
Why do you want to join this forum?: Was a necrobabes member for years, Sam's Place, etc. Lurk on PP and DS. Looking for a new hub to the community now that NB isn't around anymore.
Contact:

Photoshop Tutorial - Extracting an Image

Post by syncret »

Just put this up on DFN, and figured I'd share it here too.
Here's a quick tutorial to help you fill up your toybox. We'll work on extracting a gun or other object for use in your photomanips.

(Please note that this is far from the only way to do the work, and may not even be the best way - this is just how I've been doing it, and seems to work pretty well for me. This tutorial assumes that you're using Adobe Photoshop (in my case, Photoshop CS4, though none of the stuff we'll be doing involves features you can't find in older versions.) Other software may provide similar capabilities, but the methods will probably be different.)

Step one, of course, is finding a good source image. You want an image with a fairly decent resolution (at least appropriate to the images you're going to be compositing it into), and whose lighting isn't so unusual that you'd never be able to match it into another scene (though there are plenty of ways we can match lighting later).
The base image
The base image
tut_extraction01.jpg (10.13 KiB) Viewed 10393 times
For this runthrough, I found a decent source image on a web search for a Beretta M92. It's not perfect, but it'll do. The background is fairly clean, which will help us extract the gun more easily, and nothing's out of focus.

The first thing we'll want to do is crop off the parts of the image we're not going to be using. In Photoshop, hit 'M' to activate the Marquee Select tool. Check the toolbox palate to ensure that the rectangular marquee is selected. If not, hit 'Shift+M' to switch the tool to use rectangular selection. (Note that you can also select the marquee tool by clicking it in the toolbox palette, and change its mode by clicking and holding over it. I just find it faster in the long run to learn and use the keyboard shortcuts.) Now drag a selection marquee to surround the part of the image you care about, and then hit Image-->Crop to discard the rest. Now hit Ctrl+D to get rid of the selection marquee, since we're done with it.

Now it's time to extract the gun. There are many ways to do this, and it's often the case that the best method to use will depend on the characteristics of the image you're working with. The method I'll describe here works pretty well in most cases.

To begin with, hit 'W' to activate the Quick Selection Tool. (Make sure you have the Quick Selection Tool active, and not the Magic Wand, which shares the same slot on the palette.) Now begin painting with the Quick Select Tool over the gun and the hand. Use the bracket keys ([ and ]) to change the size of the selection tool as you go. If it selects something you don't want it to include, hold down the Alt key while painting to subtract from the selection. To add more to the selection, hold down the Shift key as you paint.

On an image like the one I chose, with a reasonably clean background, the Quick Select Tool will do a decent job of finding the edges of the objet. If your image has a really noisy background, or a background that doesn't contrast much with the foreground, it'll be more difficult.
The Quick Select Tool
The Quick Select Tool
tut_extraction03.jpg (86.67 KiB) Viewed 10395 times
After a quick bit of work, I have a halfway decent selection. It's far from perfect, but not to worry - there's plenty we can do to clean up our selection.

Before we do anything else, let's save our selection so we don't lose our work so far. (If you accidentally clicked somewhere else and lost your selection, hit Ctrl+Shift+D to restore it.) Hit Select-->Save Selection, and give our selection a name (I called mine "Gun QuickSelect").

If you check in your Channels palette, you'll see that the saved selection has now been added as a channel with the name you just gave it. We can restore our selection at any time from this channel by Ctrl+clicking the channel. Try it out. Hit Ctrl+D to wipe out your selection, then Ctrl+Click the selection channel to reload it. Now we've got a good baseline we can return to if we make a mistake cleaning up our selection.

Let's start cleaning up our selection. Hit 'Q' to enter Quick Mask mode. This is an incredibly useful tool that allows you to clean and modify selections in all sorts of ways. In Quick Mask mode, your selected object will be colored normally, and the background will be tinted red (by default).
Quick Mask
Quick Mask
tut_extraction04.jpg (90.5 KiB) Viewed 10392 times
We can clearly see in this mode that our selection has some problems we'll want to solve.

You can do almost anything to your selection mask in the Quick Select mode. It works like this: tinted areas are your Mask - these are areas that will be excluded from your selection. Clear areas are your selection. You can use painting tools and the eraser to add masking to areas you want to crop out, and erase the mask from areas you want to include. If you use soft-edged brushes for your painting and erasing, you'll get soft edges on your mask, which can be useful if you're dealing with a blurred foreground image.

Let's do some work on our mask. On my machine, the Quick Select Tool cut out part of the gun's barrel. I could clean this up by using the eraser tool to erase the unwanted mask, but there's no way my hand is going to be steady enough to get the barrel's edge perfectly straight, so what I'm going to do instead is use the Polygonal Lasso tool to put the edge right where I want it. Hit 'L' to activate the Lasso tool, and if it's not already set to the Polygonal Lasso, hit Shift+L or click and hold over the tool to toggle to the correct tool.

Using the Polygonal Lasso tool, click to place a point at the edge of the gun's barrel, then place another point further down the barrel - a line will appear between the two points. Continue placing points to enclose the part of the mask you want to remove, then double-click to close the loop. A selection marquee will appear where you placed your anchor points. Hit the Backspace key to erase everything inside it. You should now have a clean, straight line at the edge of your gun barrel.

Hit Ctrl+H to hide the selection marquee to see what your mask looks like now, and then hit Ctrl+H again to unhide it.

In my case, I straightened the edge, but there's a little too much background showing behind part of the barrel, so I use the Polygonal Lasso to mark out an area I'd like to fill with the mask, and then hit Shift+F5 to open the Fill dialog. I select Black as my fill contents and hit OK. The area is now masked out.

Using the Polygonal Lasso tool to select areas and either delete their masking or use Shift+F5 to add more masking is a great way to get really precise edges on hard surfaced objects like guns and knives.

Once we've got the gun reasonably clean, it's time to go to work on the softer forms of the hand. For this, we'll use the Paint Brush and the Eraser to add and remove masking. In my case, the Quick Select tool selected too much background behind the wrist, so I'm going to use the Paint Brush to paint in some masking. In addition, by using a brush with a slightly soft edge, I'll get a much softer edge around the arm, which is going to look more natural when I composite it into another scene.

Hit 'B' to select the Paint Brush, and make sure you're painting
in Black. Use the Paint Brush to clean up the edges of the hand and wrist. (Reducing the brush Hardness will give you a softer edge.) Use the Bracket keys ([]) to change your brush size as you work. Hit E to select the Eraser tool to remove unwanted masking. Keep working with the brush and the Eraser to get a good clean mask around your object. With practice, you'll get pretty fast at this.

Once you've gone through the process of cleaning up your mask in the Quick Mask tool, it's time to take a look at our extracted element and see what we got. Hit 'Q' to exit Quick Mask mode, and before you do anything else, hit Select-->Save Selection to save your cleaned-up mask. (I named mine "Gun Cleaned".)

Now we're going to paste the selection onto a new layer to see what we got. With your Layers palette visible, hit Ctrl+J to paste the selection onto a new layer. Hide all the layers but the new one you just created, and see how your selection looks. (I sometimes find it useful to create a new layer under my test layer and use Shift+F5 to fill it with 50% Gray - this sometimes makes it easier to see how my edges are going to look when composited.)

I can see a couple mistakes in my selection, so I go back to Quick Mask to clean them up. To do this, I return to my source layer, making it visible again, and I either hide or delete the layer I pasted my test onto. Then I activate my saved selection again by going to my Channels palette and Ctrl+Clicking the "Gun Cleaned" channel to reactivate the selection. (Alternately, I could hit Select-->Load Selection, and select my saved selection from the pulldown list.)

With my selection active, I hit Q to return to Quick Mask, and I clean up whatever mistakes I spotted.

At last, I've got a pretty clean selection but the edges are a little too hard to match the source image, which is slightly blurred. This is easily fixed by feathering the edge a little.

I hit Shift+F6 to open the Feather dialog (or hit Select-->Modify-->Feather), and give it an 0.5 pixel feathering radius. This'll soften the edges a tiny bit without significantly cutting into the image.

Once again, I paste my selected object onto a clean layer using Ctrl+J, and voila! Not too bad. This ought to drop pretty cleanly into another image when I'm ready to do some compositing.

Anyway, I just wanted to share a quick tutorial here on how I go about extracting objects for my toybox. Would love to hear how others do this too - I'm sure there are a ton of techniques that can make this even easier. And if it helps a new photomanipulator get on his or her feet, so much the better ;)
Syncret
User avatar
syncret
Posts: 44
Joined: Mon Feb 01, 2010 12:59 am
What is your main fetish?: Shooting fantasies primarily
Why do you want to join this forum?: Was a necrobabes member for years, Sam's Place, etc. Lurk on PP and DS. Looking for a new hub to the community now that NB isn't around anymore.
Contact:

Re: Photoshop Tutorial - Extracting an Image

Post by syncret »

Here's the final extracted element in its own layer:
The final extraction in its own layer
The final extraction in its own layer
tut_extraction05.jpg (87.04 KiB) Viewed 10400 times
Syncret
User avatar
Algenon5
Posts: 3530
Joined: Fri Apr 04, 2008 11:30 am
What is your main fetish?: old shoes
Why do you want to join this forum?: bored
Referral: Ad in The Watch Tower
Location: The Great White North, almost
Contact:

Re: Photoshop Tutorial - Extracting an Image

Post by Algenon5 »

Outstanding! Thanks! Now all we need is for someone to do the same for GIMP.

Al
MINISTRY OF CULTURE APPROVED
Post Reply

Who is online

Users browsing this forum: No registered users and 216 guests