این مقاله رو به درخواست یکی از دوستان عزیزم از مجله ی معروف Digital Camera گذاشتم به زبان انگلیسی است . می توانید در ادامه مطلب بخوانید .
The "Magic" Behind The Wand
Before we look at a real world example of the Magic Wand in action, let's see how the tool works and how there's really nothing magical about it. Here's a simple image I've created showing a black to white gradient separated by a solid red horizontal bar through its center:
A simple gradient divided by a red bar, but you knew that already.
As I mentioned, Photoshop's Magic Wand selects pixels based on tone and color. When we click on an area in the image with the tool, Photoshop looks at the tone and color of the area we clicked on and selects pixels that share the same color and brightness values. This makes the Magic Wand exceptional at selecting large areas of solid color.
For example, let's say I want to select the horizontal red bar. All I need to do is click anywhere on the red bar with the Magic Wand. Photoshop will see that I've clicked on an area of red and will instantly select every pixel in the image that shares that same shade of red, effectively selecting the red bar for me just by clicking on it:
One click with the Magic Wand is all it took to select the entire red bar.
Selecting the solid colored red bar was easy enough, since there were no other pixels in the image that shared the same shade of red, but let's see what happens if I click with the Magic Wand on one of the gradients. I'll click on an area of middle gray in the center of the gradient above the red bar:
The selected area after clicking in the middle of the upper gradient.
This time, Photoshop selected an entire range of brightness values rather than limiting itself to pixels that were exactly the same tone and color as the middle gray area I clicked on. Why is that? To find the answer, we need to look up in the Options Bar along the top of the screen. More specifically, we need to look at the Tolerance value:
The Magic Wand's Tolerance option.
The Tolerance option tells Photoshop how different in tone and color a pixel can be from the area we clicked on for it to be included in the selection. By default, the Tolerance value is set to 32, which means that Photoshop will select any pixels that are the same color as the area we clicked on, plus any pixels that are up to 32 shades darker or 32 shades brighter. In the case of my gradient, which contains a total of 256 brightness levels between (and including) pure black and pure white, Photoshop selected the entire range of pixels that fell between 32 shades darker and 32 shades brighter than the shade of gray I initially clicked on.
Let's see what happens if I increase the Tolerance value and try again. I'll increase it to 64:
Doubling the Tolerance value from 32 to 64.
With Tolerance now set twice as high as it was originally, if I click with the Magic Wand on the exact same center spot in the gradient, Photoshop should now select an area twice as large as it did last time, since it will include all the pixels that are between 64 shades darker and 64 shades lighter than the initial shade of gray I click on. Sure enough, that's what we get:
This time, with a Tolerance setting twice as high, the selected area of the gradient is twice as large.
What if I want to select just the specific shade of gray I click on in the gradient and nothing else? In that case, I'd set my Tolerance value to 0, which tells Photoshop not to include any pixels in the selection except those that are an exact match in color and tone to the area I click on:
Setting the Tolerance value to 0.
With Tolerance set to 0, I'll click again on the same spot in the center of the gradient, and this time, we get a very narrow selection outline. Every pixel that's not an exact match to the specific shade of gray I clicked on is ignored:
Increasing or decreasing the Tolerance value has a big impact on which pixels in the image are selected with the Magic Wand.
You can set the Tolerance option to any value between 0 and 255. The higher the value, the wider the range of pixels that Photoshop will select. A Tolerance setting of 255 will effectively select the entire image, so you'll usually want to try a lower value.
As we were exploring the effect the Tolerance setting has on Magic Wand selections, you may have noticed something strange. Each time I clicked on the gradient above the red bar, Photoshop selected a certain range of pixels but only in the gradient I was clicking on. The gradient below the red bar, which is identical to the gradient I was clicking on, was completely ignored, even though it obviously contained shades of gray that should have been included in the selection. Why were the pixels in the lower gradient not included?
The reason has to do with another important option in the Options Bar - Contiguous. With Contiguous selected, as it is by default, Photoshop will only select pixels that fall within the acceptable tone and color range determined by the Tolerance option and are side by side each other in the same area you clicked on. Any pixels that are within the acceptable Tolerance range but are separated from the area you clicked on by pixels that fall outside the Tolerance range will not be included in the selection.
In the case of my gradients, the pixels in the bottom gradient that should otherwise have been included in the selection were ignored because they were cut off from the area I clicked on by the pixels in the red bar which were not within the Tolerance range. Let's see what happens when I uncheck the Contiguous option. I'll also reset my Tolerance setting to its default value of 32:
Contiguous is selected by default. Click inside the checkbox to deselect it if needed.
I'll click again in the center of the upper gradient with the Magic Wand, and this time, with Contiguous unchecked, the pixels in the bottom gradient that fall within the Tolerance range are also selected, even though they're still separated from the area I clicked on by the red bar:
With Contiguous unchecked, any pixels anywhere in the image that fall within the Tolerance range will be selected.
Up next, we'll look at some additional options for the Magic Wand and a real world example of it in action as we use it to quickly select and replace the sky in a photo!
Tolerance and Contiguous are the two options that have the biggest impact on the Magic Wand, but there's a couple of other options worth noting. Since the Magic Wand selects pixels and pixels are square-shaped, our selection edges can sometimes appear harsh and jagged, often referred to as a "stair stepping" effect. Photoshop can smooth out the edges by applying a slight blur to them, a process known as anti-aliasing. We can turn anti-aliasing for the Magic Wand on and off by checking or unchecking the Anti-alias option in the Options Bar. By default, it's enabled and in most cases you'll want to leave it enabled:
Leave anti-aliasing enabled with the Magic Wand to smooth out otherwise jagged selection edges.
Also by default, when you click on an image with the Magic Wand, it looks for pixels to select only on the layer that's currently active in the Layers panel. This is usually what we want, but if your document contains multiple layers and you want Photoshop to include all the layers in your selection, select the Sample All Layers option in the Options Bar. It's unchecked by default:
Leave Sample All Layers unchecked to limit your selection to the active layer.
Now there's a better way to learn! Download our tutorials as print-ready PDFs!
Real World Example
Here's an image I have open in Photoshop. I like the photo in general, but the sky could look more interesting. I think I'll replace the sky with a different one:
The clear blue sky looks a bit bland.
Replacing the sky means I'll first need to select it. As I mentioned earlier, the Magic Wand excels at selecting large areas of solid color, and since the sky is clear blue with only a slight variation in the tone, the Magic Wand will make selecting it easy. With the tool selected and all of its options in the Options Bar set back to their defaults (Tolerance 32, Contiguous checked), I'll click somewhere in the top left of the image:
Clicking with the Magic Wand in the top left of the sky.
If the sky had been solid blue, the Magic Wand would have had no trouble selecting all of it with that one single click. However, the sky actually transitions from a lighter shade of blue just above the buildings to a darker shade near the top of the photo, and my Tolerance value of 32 wasn't quite high enough to cover that entire range of tonal values, leaving a large area of the sky directly above the buildings out of the selection:
Some lighter areas of the sky just above the buildings were not included in the selection.
Adding To Selections
Since my initial attempt failed to select the entire sky because my Tolerance value was too low, I could try again with a higher Tolerance value, but there's an easier way to fix the problem. As with Photoshop's other selection tools, the Magic Wand has the option to add to existing selections, which means I can keep the selection I've started with and simply add more of the sky to it!
To add to a selection, hold down your Shift key and click in the area you need to add. You'll see a small plus sign (+) appear in the bottom left of the Magic Wand's cursor icon letting you know you're about to add to the selection. In my case, with Shift held down, I'll click somewhere inside the sky that wasn't included in the selection initially:
Holding the Shift key down and clicking on the area I need to add.
And just like that, Photoshop was able to add the remaining area of the sky to the selection. Two clicks with the Magic Wand was all it needed:
The entire sky is now selected.
Selecting What You Don't Want First
Of course, since the sky is being replaced, what I should have selected in the image was everything below the sky, since that's the area I want to keep. But drawing a selection outline along the tops of the buildings with one of Photoshop's other selection tools like the Polygonal Lasso Tool or the Magnetic Lasso Tool would have taken more time and effort, while selecting the sky with the Magic Wand was quick and easy. This brings us to a popular and very handy technique to use with the Magic Wand, which is to select the area you don't want first and then invert the selection!
To invert the selection, which will select everything that wasn't selected (in my case, everything below the sky) and deselect everything that was (the sky itself), go up to the Select menu at the top of the screen and choose Inverse. Or, for a faster way to invert selections, use the keyboard shortcut Shift+Ctrl+I (Win) / Shift+Command+I (Mac):
Go to Select > Inverse.
With the selection now inverted, the sky is no longer selected while everything below it in the image is:
The area I need to keep is now selected.
To replace the sky at this point, I'll press Ctrl+J (Win) / Command+J (Mac) to quickly copy the area I'm keeping to a new layer in the Layers panel:
The selection has been copied to a new layer above the original image.
Next, I'll open the image I want to replace the original sky with. I'll press Ctrl+A (Win) / Command+A (Mac) to quickly select the entire image, then Ctrl+C (Win) / Command+C (Mac) to copy it to the clipboard:
The photo that will replace the sky in the original image.
I'll switch back over to my original image and I'll click on the Background layer in the Layers panel to select it so that, when I paste the other sky photo into the document, it will appear between my existing two layers:
Selecting the Background layer.
Finally, I'll press Ctrl+V (Win) / Command+V (Mac) to paste the new image into the document. Everyone loves a blue sky, but sometimes a few clouds can make a bigger impact:
The sky has successfully (and quite easily) been replaced.
Like Photoshop's other selection tools, the trick to using the Magic Wand successfully and avoiding frustration is knowing when to use it and when to try something else. As we've seen in this tutorial, the Magic Wand's biggest strength is its ability to select large areas of pixels that all share the same or similar color and tone, making it perfect for things like selecting and replacing a simple sky in a photo, or for any image where the object you need to select is in front of a solid or similarly colored background. Use the "select what you don't want first" trick for times when selecting the area around the object with the Magic Wand would be faster and easier than selecting the object itself with a different tool.
Photoshop CS5 New Features - Content-Aware Fill
Written by Steve Patterson. In a previous tutorial, we looked at Photoshop CS5's upgraded Spot Healing Brush with its brand new Content-Aware Healing option that lets Photoshop examine the actual contents of your image as it tries to figure out the best way to remove or repair the damaged or unwanted area you've clicked on. This time, we look at another new feature in Photoshop CS5 - Content-Aware Fill. It's no coincidence that both of these new features share similar names, since they do pretty much the same thing. The main difference is in how we use them.
Both features let Photoshop analyze the contents of the image to figure out what the photo would have looked like if the unwanted object or area had never been there. But even with its new Content-Aware abilities, the Spot Healing Brush is still best suited for smaller areas that we can easily click on or paint over. Content-Aware Fill, on the other hand, lets us repair or replace larger, more complex areas, and even multiple areas at once, simply by drawing selections around them and letting Photoshop do the rest!
Download our tutorials as printable PDFs! Learning Photoshop has never been easier!
Here's a photo that suffers from a couple of distracting elements, especially the large wooden post blocking the view of the mountains above the Visitor Center sign:
A nice view of the mountain. Too bad that post is in the way.
The traditional way to remove the post would be with the Clone Stamp Tool, but let's see if the new Content-Aware Fill option in Photoshop CS5 can make the job easier for us. As always, I'll first press Ctrl+J (Win) / Command+J (Mac) on my keyboard to create a copy of my image so I'm not making any changes to the original. If we look in the Layers panel, we see that I now have two layers, each containing the same image. The original photo will remain safe on the Background layer, and all of the editing work I'm about to do will be done to the copy of the image on Layer 1 above it:
Working on a copy of the image to protect the original.
Since "Layer 1" isn't very descriptive, I'll double-click directly on the layer's name in the Layers panel and change it to "content-aware fill", pressing Enter (Win) / Return (Mac) when I'm done to accept the name change:
Renaming the layer to keep things organized.
To use Content-Aware Fill, we first need to draw a selection around the object or area we want to remove or replace. Since the post is a simple, straight-sided shape, I'll use the Polygonal Lasso Tool, which is hiding behind the standard Lasso Tool in the Tools panel. To access it, I'll click and hold on the Lasso Tool until the fly-out menu appears, then I'll select the Polygonal Lasso Tool from the list:
The Polygonal Lasso Tool is still hiding behind the standard Lasso Tool in Photoshop CS5.
With the Polygonal Lasso Tool selected, I'll press the letter F on my keyboard to switch out of the document window and into full screen mode, which will make it easier to select the top of the post. Then I'll just click my way around the post to select it. You'll want to stay close to the edges of the object you're selecting for Content-Aware Fill to work best, but there's no need to be surgically precise:
A selection outline now appears around the post.
With the selection in place, I'll go up to the Edit menu at the top of the screen and choose the Fill command:
Choosing the Fill command from the Edit menu.
Just as Content-Aware Healing is a new option for the Spot Healing Brush in Photoshop CS5, Content-Aware Fill is a new option in the Fill dialog box. We select it by choosing Content-Aware in the Contents section at the top:
Photoshop CS5 now gives us a Content-Aware option in the Fill dialog box.
In Photoshop CS4 or earlier, all we could fill a selection with was a solid color or pattern, but with Content-Aware selected in CS5, Photoshop can now examine the contents of the image and try to fill in the selected area with actual image detail, as if the object we're removing never existed! At least, that's the idea of it. Let's see what happens when I click OK to exit out of the Fill dialog box:
Content-Aware Fill was able to easily remove the post from the photo.
Just like that, the post is gone! Photoshop CS5 did an outstanding job of removing it and filling the area with image detail as if the post had never been there, and all I had to do was draw a selection around it and choose Content-Aware from the Fill dialog box. Is it 100% perfect? Not quite. The top of the mountain looks a little strange, and a couple of areas look like a repeating pattern, but what we're left with now is nothing more than a quick clean up with the standard Healing Brush or the Clone Stamp Tool rather than having to put in a lot more time and effort by doing it all ourselves.
There's another distracting object of some sort in the bottom right corner of the photo that I'd like to remove, so I'll use the standard Lasso Tool this time to draw a quick selection around it:
Drawing a selection around the object with the Lasso Tool.
With the object selected, I'll go back up to the Edit menu and once again choose the Fill command. When the Fill dialog box appears, I'll again choose the new Content-Aware option. Finally, I'll click OK to exit out of the dialog box, and Photoshop CS5 does another great job at removing the object from the photo, filling the area with new image data:
Another distracting object removed with almost no effort.
If you don't like the results after running Content-Aware Fill, simply undo it by pressing Ctrl+Z (Win) / Command+Z (Mac), then running it again. You'll get a different result each time.
Back in a previous tutorial, we looked at how to stitch multiple photos together to create a panoramic image using the Photomerge command in Photoshop CS4. We won't get into details here on how to create panoramic images since we covered it in the other tutorial, but if you've used Photomerge before, you'll be familiar with the problem seen in the image below.
This is the panorama I created in the tutorial as it appeared right after running the Photomerge command, which left me with lots of empty blank space around the image:
Photomerge is great at stitching images together, but it leaves lots of blank space around the result.
Normally (as in prior to Photoshop CS5), we'd get rid of all that blank space by simply cropping it away with the Crop Tool, but let's see what happens when we let Photoshop try to replace the blank areas with actual image detail using Content-Aware Fill.
I've gone ahead and merged all of the layers onto a single layer, and I'll quickly select the image by holding down my Ctrl (Win) / Command (Mac) key and clicking directly on the preview thumbnail in the Layers panel:
Holding Ctrl (Win) / Command (Mac) and clicking on the preview thumbnail.
As soon as I click on the thumbnail, a selection outline appears around the image:
The image is now selected. The blank areas are not.
At the moment, the image is selected, but I don't want to fill the image with anything. I want to fill the blank space around it, so I need to invert my selection, which will select the blank areas and deselect the image. To do that, I could go up to the Select menu at the top of the screen and choose Inverse, but I'll use the faster keyboard shortcut Shift+Ctrl+I (Win) / Shift+Command+I (Mac):
The blank areas are now selected. The image is not.
With the blank area now selected, I'll go up to the Edit menu and choose Fill, just as I did before, and I'll select the new Content-Aware option at the top:
Selecting Content-Aware in the Fill dialog box.
I'll click OK to exit out of the dialog box, and after waiting a few moments for Photoshop to analyze the image, we get the results. I'll press Ctrl+D (Win) / Command+D (Mac) to remove the selection outline so we can see the image better:
Content-Aware Fill was able to extend the image into the blank area.
Does Photoshop CS5 have some serious wow factor going on? I would say so. Again, the results aren't perfect. There's an obvious dark blotch in the clouds in the top right corner of the image and some of the water along the far left and right edges appears blurry, but Content-Aware Fill was able to do 80-90% of the work for me in a matter of seconds, leaving me with nothing more than a quick clean up with one of the other retouching tools. I'd call that impressive!
As we've seen, Content-Aware Healing and Content-Aware Fill are great new additions in Photoshop CS5, but they're certainly not the only new features. More are on the way