For starters, let us define what the background eraser tool is and what it is not. The background eraser tool is not
some artificially intelligent tool that can determine by inspection what in an image you would consider to be the background,
or what you would classify to be the subject for that matter.
If you have five different pictures you can have five completely different and valid
backgrounds and several subjects. A vase against a brick wall,
two butterflies in a field of flowers, a beach ball and bucket in the sand, each scene has its own complexity of background and subjects. How you classify
the parts of an image is purely subjective depending on what you want to extract from the image.
This leads to the question, "Well, how does the background eraser tool remove the background?" The answer is the background eraser does not
remove backgrounds in the strictest sense. It simply erases the areas of color that you choose to be the background. For instance, if you click in and erase
the sand in the background of the beach ball you are effectively removing the background. What you use to decide what is sand in the image
is the beige color of the sand. This is what the background eraser tool uses to remove parts of an image. The background eraser tool is a color based eraser.
To use the background eraser tool effectively you need to understand how it erases pixels. Like the eraser tool the
background eraser is a brush tool that reduces the alpha value of the pixels in its stroke. Remember, lowering the alpha value
of a pixel makes it more transparent. So if the eraser lowers the alpha of pixels in its stroke or sets it to zero, it
makes them more or fully transparent, what we call 'erasing'.
Unlike the regular eraser tool that blanket erases everything in its stroke, the background eraser tool is selective. It uses color
similarity to decide what pixels to erase in the image. It compares the color of the pixels in its brush stroke to a set
color. If the difference between the pixel in the stroke color and the sample color is within a
user set Tolerance
the pixel is erased, otherwise it is left unchanged.
How the sample color is set is determined by the 'Sampling' mode in the tool options bar. The sampling mode is important because it
controls how the background eraser tool erases when it strokes the image. To set the sampling mode click to open the 'Sampling'
dropdown in the options toolbar.
In Continuous Sampling
mode the sample color is automatically updated as long as you are dragging in the image. Lets look at the example image below. If you start dragging in the red area then
subsequently drag through the green then blue areas, the sample color will change to green then blue based on the color under the center of the brush as shown by the dots in the image below.
The green and blue areas in the background eraser stroke will be erased respectively because the background eraser is always updating its sample color to match the area it is in.
When erasing in continuous sampling mode you have to be careful to avoid drifting into and erasing the region you want to keep.
However, continuous sampling is particularly useful when there are variations in the color of the area you want to erase.
In Initial Sampling
mode, the sample
color is set to the pixel color at the center of the brush when you press the mouse to begin the stroke. The sample color will remain constant as long as you keep dragging
the mouse. The image shows the result of stroking starting in the red area then dragging through the green then blue regions.
The sample color never changes which is shown below by the small red dots in the center of the stroke.
The green and blue areas are not erased because the background eraser is only checking against the initially set red sample color.
The Background Color
is the final sampling mode option. This mode sets the sample color to the background color swatch.
It is the only mode where the sample color is not changed when you use the mouse on the image.
The sample color will only change when you change the background color.
Choosing the correct sampling mode goes a far way in getting acceptable results with the background eraser tool. You may need to do
test strokes to see how the eraser behaves in the area you want to remove. You can always undo the action then change the sampling mode to
see if you get a better result.
sets how similar a pixel color should be to the sample color for it to be erased in the eraser stroke. You enter the tolerance value in the tool option bar 'Tolernace' input field.
If the tolerance is set to zero (0%) or very low values only colors that are exactly the same
or close to the sample color are erased. If set to 100% then all colors in the stroke will be erased like a regular eraser tool.
Simply put, the higher the tolerance the farther in color a pixel can be from the sample color and still be erased.
To illustrate how tolerance affects the background eraser take a look at the image below.
The first image is the unerased test image. It contains a set of concentric circles that change color from a slightly yellow green
in the center to dark green in the outer ring. The white ring is the brush profile of the background eraser tool. The second image shows clicking in the image with a tolerance of 10%,
the third a tolerance of 35% and the last 55%. As you can see the erased area in the stroke spreads to the darker green rings the more the tolerance is increased.
Getting the right tolerance to adequately erase the area you want can be an exercise in trial and error.
You may have to work through several tolerance values and observe how the area is erased while you increase
or decrease tolerance values.