Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Changing Background for Profile Photo

Bryce Harmison
Registered User
Join date: 28 Dec 2005
Posts: 28
08-01-2008 22:12
I took a head shot of someone against a white background. I sent the photo to PhotoShop CS3. I made an alpha channel mask which eliminated the white background using one of Chosen Few's tutorials. At this point I couldn't figure out how to create a new background. So I cheated and saved my image as a png, then reloaded the png and made a new layer for the background. My question is: how can I create a new background without saving and reloading.
thanks
Bryce
Rolig Loon
Not as dumb as I look
Join date: 22 Mar 2007
Posts: 2,482
08-02-2008 06:24
There's no transparency in a profile photo, so I can't imagine why you are creating an alpha channel. All you have to do is:

1. Open your original photo.
2. Use Layers >> New >> Layer From Background to unlock it.
3. Select the magic wand tool.
3. Click on the white background to select it.
4. Select Edit >> Clear to remove the selected white.
5. Create a new layer and move it under the layer that has your edited photo on it.
6. Edit >> Fill the new layer with your favorite color.
7. Crop the image and resize it if you really need to.
8. Save it. I prefer TGA (24-bit -- remember, there's no alpha channel), but PNG will do. Heck, even JPG will do, but it's a silly choice.
9. Upload it to SL.

One of the simpler tasks you'll ever have to do with Photoshop. :)
Chosen Few
Alpha Channel Slave
Join date: 16 Jan 2004
Posts: 7,496
08-02-2008 08:35
Bryce, you were on the right track, but instead of an alpha channel, what you wanted was a layer mask. It's almost the same thing, except it only affects one layer instead of affecting the whole image.

Below is a modified version of a step-through I posted in another thread on a similar topic. The image in question for that thread was a wreath. I've left it with that, since I don't feel like taking the time to redo it with an avatar picture. I'm sure everyone reading will be intelligent enough that it won't make a difference. Whether the subject be wreath, an avatar, or of anything else, the procedure is the same.

Note, the steps start from the beginning, as if the image doesn't already have an alpha channel. Since you've already got yours, Bryce, you could skip directly to step 6. You still might want to read the whole thing, though, since it might help you make alphas a little faster for this kind of work.

Also, be aware that this is certainly not the only way to make a mask, or even the preferred way, in the majority of circumstances. It just happens to be the best way, in my opinion, to proceed when the task at hand is a background extraction. For other tasks, you'd use different procedures.


1. Take a look at each of the image's three color channels individually. Pick which one has the most contrast, and duplicate it.

In the case of the wreath image, the channel with the most contrast is the Blue channel. Here's what that it looks like on its own.



2. Open the Levels dialog (Image -> Adjustments -> Levels), and use the Input sliders to increase the contrast as much as possible, without losing detail around the edges of the subject.

For the wreath, raising the black slider to about 170 or so does the trick. Here's what the channel looks like now. Notice it's already starting to look like a proper alpha channel or mask.



3. Since we happen to be working with a dark subject against a light background, we've got our blacks and whites opposite of how we'll want them in our finished mask. Let's correct that now by inverting the colors (ctrl-I).

That's more like it.



4. Now just run over the edges of the subject with the Burn tool, at a high exposure setting. This will remove things like the existing shadow, which is gray in the channel, as well as those pesky in-between-the-pine-needles areas. This will take just a few seconds. (Note, this works equally well for hair on human and animal subjects, and for any other type of fringe).

You'll also want to use the Dodge tool, and/or a white paintbrush to remove the stray black dots in the subject. This too will only take a couple of seconds.




5. At this point, if all you wanted was an alpha channel, you're done. You've got your it, exactly the way it needs to be. Save as 32-bit TGA, and you're all set.

If you want to copy the channel to a layer mask, read on. The following steps will take a second or two, each.


6. If you've only got one layer in your image right now, chances are it's a background layer. Before you'll be able to apply a mask to it, you'll need to change it to a regular layer. Do this simply by double clicking on its name in the Layers palette. In the dialog that pops up, name the layer whatever you want, and hit OK.


7. In the Channels palette, ctrl-click on the alpha channel's thumbnail to select it on the canvas.


8. In the Layers palette, click once on the name of the layer to which you want to apply your new mask. If there's only one layer, there's no choice to make here, obviously, but if you've got more than one, make sure you're working on the right one. Then click on the Make New Mask From Selection button at the bottom of the palette. It's the one that looks like a white circle in the middle of a gray rectangle.

As soon as the mask is created, its black areas (which in this case are the background) will hide the corresponding pixels on the layer, turning them transparent.



Now, to add a new background, you can simply create a new layer, move it below the subject's layer, and put whatever you want on it.

Remember to delete the alpha channel before you save, by the way. You want a 24-bit image here, not 32-bit.


Just so you know, total elapsed time for this, not counting posting the screenshots to the Web, and writing all these words, was about one minute. For this type of extraction, you'll find channel masking like this to be very fast, efficient, and accurate. I do it all the time.




Rolig, just so you know, I never recommend using the magic wand. It's pretty clunky, doesn't offer much in the way of precision or control, and it's artifact-prone. Its only real advantage is that it's fast. But I'd rather take a couple extra seconds (and a few seconds really is all you need) to make sure things are done right.

Also, I almost never recommend clearing or deleting pixels. It's destructive. Generally speaking, you shouldn't ever do anything that can't later be undone at any time. This is where masks come in. They hide pixels, making them look like they've been cleared, but they're really still there. You can remove or change the mask at any time, and all that information will still be there.
_____________________
.

Land now available for rent in Indigo. Low rates. Quiet, low-lag mainland sim with good neighbors. IM me in-world if you're interested.
Rolig Loon
Not as dumb as I look
Join date: 22 Mar 2007
Posts: 2,482
08-02-2008 08:50
From: Chosen Few
Rolig, just so you know, I never recommend using the magic wand. It's pretty clunky, doesn't offer much in the way of precision or control, and it's artifact-prone. Its only real advantage is that it's fast. But I'd rather take a couple extra seconds (and a few seconds really is all you need) to make sure things are done right.

Also, I almost never recommend clearing or deleting pixels. It's destructive. Generally speaking, you shouldn't ever do anything that can't later be undone at any time. This is where masks come in. They hide pixels, making them look like they've been cleared, but they're really still there. You can remove or change the mask at any time, and all that information will still be there.


Thanks, Chosen. It IS pretty clunky, but for a job as simple as this one it also involves the fewest steps. Normally I wouldn't choose a destructive method either. When the task is simply to remove a contrasting monochrome background from a single layer -- otherwise unedited -- you're never more than a couple of mouse clicks from being able to start fresh if you screw up, though. The magic wand is arguably the easier method for a new user in this case, so why not use it? .... OK, I know why .... developing good work habits. Still, there is a place for quick and dirty in the repertoire too, isn't there? :)
Morgaine Alter
dreamer
Join date: 10 Jan 2008
Posts: 1,204
08-02-2008 09:12
Thank You guys this helped me to.
_____________________
https://www.xstreetsl.com/modules.php?name=Marketplace&MerchantID=125705

From: Phil Deakins
My zip gun stays right where it belongs - in my pants!
Rolig Loon
Not as dumb as I look
Join date: 22 Mar 2007
Posts: 2,482
08-02-2008 11:11
From: Rolig Loon
The magic wand is arguably the easier method for a new user in this case, so why not use it? .... OK, I know why .... developing good work habits. Still, there is a place for quick and dirty in the repertoire too, isn't there? :)


OK, Chosen, so I just answered my own not-quite-rhetorical question. I did a little experiment with a head shot of my own, and used the magic wand method to clear the background before dropping it onto a new layer. I took the same photo and did it your way, with a mask. The magic wand is definitely quicker, but it's also lots dirtier than I expected. As you said, it's less precise, so you end up with ratty edges and with leftover pixels between strands of hair. If I wanted to go to the trouble of making it as clean as the image I built a mask for, it would take me a lot longer, and I would probably go nuts.

Bottom line: I can still argue weakly for using the magic wand when you are making a postage stamp sized head shot for your profile -- It's squished so much that you can't see the messy details anyway -- but you've convinced me that I should be avoiding it even more than I have been. I guess quick doesn't beat dirty. :p
Bryce Harmison
Registered User
Join date: 28 Dec 2005
Posts: 28
08-02-2008 11:35
Thanks very much for the help