Current location - Health Preservation Learning Network - Slimming men and women - How to change the background of photos with Photoshop?
How to change the background of photos with Photoshop?
In the post-processing of photos, we often use Photoshop to extract the material of people in photos to achieve special effects such as background replacement. There are many ways to extract character material by Photoshop. Let's summarize the four Photoshop matting methods introduced in this article with some small examples that change the background of people in photos:

First, the tool method-cleverly replace the background with the magic wand tool

Second, the path method-choose people with pen tools.

Third, masking method-using masking technology to cut the picture

Fourth, the filtering method-a powerful extraction filter.

Basic idea

There are many ways to change the background of photos, but the basic ideas all follow the following two:

1. After removing the unsatisfactory background in the photo, insert the extracted characters into the new favorite background picture. This method is more suitable for selecting characters by removing the background with monotonous patterns and few colors.

2. Select the character method. This idea is just the opposite of the above idea, that is, directly select the person or thing needed in the photo and cut or copy it into the predetermined background photo. This method is more suitable for selecting people or things with clear edges.

For the above two ideas of changing the background of photos, the final effect is the same, but the specific application of which idea depends on the photos that need to change the background.

Detailed description of four matting methods

First, the tool method-cleverly replace the background with the magic wand tool

Knowledge Tip: The magic wand tool mainly allows users to select an area with the same color (such as a red flower) or a picture with a monotonous background without tracking its outline. The color range selected by the magic wand tool can be controlled by the value of the "Error Range" parameter in the tool options bar. Please note that the magic wand cannot be used for images in bitmap mode.

Let's use an example to explain. Open a photo in Photoshop, as shown in figure 1. Let's analyze this photo first. Its background is dim, and the color of the background is similar. In this case, we can cut the characters by removing the background.

The creative idea of this example is to use the magic wand tool to select most background areas, and then use the method of adding selection or deleting selection to further select. If you can't choose the details, use lasso tool or magnetic lasso tool to finish.

1. After opening the photo in the Chinese version of Photoshop CS, click the magic wand tool in the toolbox, and then set the tolerance parameter value to 50 in the tool options bar that appears. Then click the left mouse button on the character background, and you can get most of the background choices. For discontinuous selection, we can click the "Add to Selection" icon in the tool options bar when selecting the magic wand tool, or hold down the Shift key on the keyboard and click other places we want to select, as shown in Figure 2.

2. Next, we further choose the background. First click the zoom tool in the toolbox to enlarge some parts of the photo. Or when the "Add to Selection" icon in the magic wand tool option bar is selected and the tolerance parameter value is appropriately changed, clicking the unselected background area with the magic wand tool will further increase the selection of background areas.

Tip: If you select a part of a character when using the magic wand tool, you can use the magnetic lasso tool, then click the "Subtract from Selection" icon in the tool options bar that appears, and then select the selection. For those small areas in the background that have not been selected, you can use the lasso tool and select the "Add to Selection" icon for further selection.

3. Next, we will extract the characters. Click the "Select → Reverse Selection" command in the menu bar, or press the shortcut key "Ctrl+Shift+I" to reverse selection to select the characters. Then press "Ctrl+C" to copy the characters, and press "Ctrl+V" to paste the characters into the new layer 1, as shown in Figure 3.

Figure 3

4. Modify the details. Select the layer where people are stored 1, use the zoom tool to enlarge the people, and use the eraser tool in the toolbox to erase the jagged part of its edge. Then hold down the Ctrl key, click the left mouse button on the character layer to select the extracted character, and then click Select → Feather in the menu bar, or press the shortcut key Alt+Ctrl+D to open the Feather dialog box, enter the Feather parameter value of 2, and click OK. In this way, the edges of the whole character will appear soft but not too stiff.

Tip: When feathering, adjust the feather parameter value, mainly depending on the rough edge of the selected person or object. If the edge of a person or object is rough, the feathering parameter value can be adjusted appropriately.

5. Add background. Click the "File → Open" command in the menu bar, find a beautiful background picture in the search range, add the previously extracted characters to the background file, and adjust the position and size. Then click the "Image → Adjust → Brightness/Contrast" command in the menu bar to open the Brightness/Contrast dialog box, and adjust the brightness of the person to suit the background. The final effect is shown in Figure 7.

Summary of knowledge points: When we matting an image, it is often difficult to distinguish the selected area from the unselected area. In this case, we can save the selected selection to a new layer, then reselect it and gradually delete the unnecessary parts. For difficult details, you can use the eraser tool to trim them.

Second, the path method-choose people with pen tools.

Knowledge Tip: Path is a method provided by Photoshop to draw the boundaries and strokes of the selection, and it is our right-hand assistant to draw images. Paths are straight lines and graphs composed of Bezier curves, which are generally divided into open paths and closed paths. If you want to convert a path into a selection, it must be a closed path. Using path to extract people is more suitable for photos with clear edges and contours.

Before we operate, let's look at the photo and think about what tools and methods are suitable for operating this photo. In this photo, we can see that the edge of the figure is clear, so we can use the path tool to extract the figure from the original background and put it in the new background.

Let's start the operation.

1. Go to Photoshop and open the photo. Click the pen tool in the toolbox and select the Path icon in the tool options bar that appears. In this way, you can use the pen tool to check the path. Next, use the zoom tool in the toolbox to enlarge the image, and then carefully check the outline of the person. The inspection method is as follows:

Draw a path node starting from any edge of the character. When two or more nodes are defined in the image, the direction of the path is determined. Continue to draw other nodes around the character in this direction. If you need to relocate a node, you can hold down the Ctrl key and click the node to modify it. Among them, the node is used to move the position of the curve, and the handle appearing on the node is used to adjust the radian of the curve. By adjusting the curvature of the curve, the path is closer to the contour edge of the person, as shown in Figure 5.

2. After checking the outline of people, we began to extract people. Press the shortcut key Ctrl+Enter to convert the selected path into a selection, or press Ctrl and click Work Path in the Paths panel to convert it into a selection. Press Ctrl+C to copy the characters in the selection, and then press Ctrl+V to paste, and the characters will be automatically saved in the newly created layer 1, as shown in Figure 6.

3. Complete the details. The operation method is similar to the operation method of cleverly replacing the background with the magic wand tool in the later stage. Firstly, the outline of the character is feathered by feathering command, so that the outline edge of the character will not appear stiff and unreal. For local areas, you can use an eraser to finish the finishing.

Tip: When using the eraser tool to trim people, especially when trimming facial details of people, you must adjust the size of the eraser tool. The finer the part, the smaller the eraser tool.

4. Finally, let's add the background and modify the final effect. Click the "File → Open" command in the menu bar to find a background picture in the search range, then press the shortcut key "Ctrl+A" to select all background pictures, and then press the shortcut key "Ctrl+C" to copy. Go back to the original file and press the shortcut key "Ctrl+V" to paste the background image, and then the system will automatically generate a new layer 2. Then, adjust the position of layer 2 with background picture to the lower part of layer 1 with people, and then adjust the size and position relationship between people and background.

For places where the transition between characters and background is unnatural, we can click the "blur" tool in the toolbox and smear it on the edge of characters, so that the transition between characters and background will be natural. Finally, we click the "Filter → Rendering → Lens Halo" command in the menu bar to open the lens halo dialog box, set the brightness parameters and lens type, and then add more lens halos to the background image, so that the final effect is completed, as shown in Figure 7.

Third, masking method-using masking technology to cut the picture

Two methods of figure matting are discussed above. Are you already familiar with the methods of extracting figure images and changing background? However, the first two methods have some similarities, that is, in the case of a single background color or a clear figure outline, the success rate of keying is relatively high, while the photos we take in real life often have complex background color and unclear figure outline, such as hair, which are not easy to handle with the above two methods. This problem can be easily solved by using the fast mask editing mode provided by hotoshop.

Knowledge tip: the mask is actually what we call the mask. It covers the image and isolates the non-editing area of the layer, which is not affected by other area operations. Using masks, you can create a selection of any shape and control the appearance of the edges of the selection. Using quick mask mode, you can quickly create and modify very accurate selection ranges. After creating the selected area as a quick mask, use the drawing tools or filters to modify the selected area to expand or shrink the selected area. Finally, when exiting the quick mask mode and returning to the normal mode, the unmasked area will become a selected area, thus creating the exact selection we want. After creating a quick mask in an image, you can use almost all tools and filters to modify the mask.

Let's analyze a photo first, as shown in Figure 8. (Thanks to Tian Tianma, the host who provided the picture material)

The background color of this photo is very complex and layered. Obviously, it is not easy to select a large background area at a time with the magic wand tool. Moreover, the edge and background of the figure outline are complicated, especially the hair. It will be more troublesome if you draw the path with a pen tool. At this time, you can consider using the editing method of quick mask.

Creative thinking: after entering the mask, first smear the edge outline of the character with a brush, then smear the whole character, then transform it into a selection, and finally extract the character.

1. Let's set the parameters of quick mask first. After opening the photo in Photoshop, double-click the "Edit in Quick Mask Mode" button at the bottom of the toolbox to open the Quick Mask Options dialog box, as shown in figure 13. In this dialog box, you can choose whether to display the color in the mask area or the selected area, and what color and how much transparency are used to display the color. Usually, the color defaults to red. If the character is red, we can choose another color with high contrast with red, such as blue, which is easier to distinguish.

2. After entering the quick mask, we click the brush tool in the toolbox to start painting. Let's talk about the outline edge of the character first. Set the brush mode to "Normal", opacity to 100% and flow to 100% in the brush options toolbar. It should be noted here that the hair should be carefully smeared, and the size and hardness of the brush should be set smaller, which is convenient for better operation.

Let's start drawing along the outline edge of the character. After drawing the outline edge of the characters, we can adjust the brush size a little bigger until all the characters are covered, as shown in figure 10.

2. After entering the quick mask, we click the brush tool in the toolbox to start painting. Let's talk about the outline edge of the character first. Set the brush mode to "Normal", opacity to 100% and flow to 100% in the brush options toolbar. It should be noted here that the hair should be carefully smeared, and the size and hardness of the brush should be set smaller, which is convenient for better operation.

Let's start drawing along the outline edge of the character. After drawing the outline edge of the characters, we can adjust the brush size a little bigger until all the characters are covered, as shown in figure 10.

Tip: To delete the smeared place, you can select the foreground color as white, and then erase it with a brush. Using the zoom tool in the toolbox when smearing will make the operation more convenient.

3. After daubing, click the "Edit in Standard Mode" button under the toolbox to return to the standard editing mode. At this time, we can see that the area outside the graphic outline has become a selection area, as shown in figure 1 1. Because we want a character, we execute the "Select → Deselect" command in the menu bar, so that the character is selected.

4. Extracting people into the new layer is still achieved according to the operation steps and methods in the last two examples. Press the shortcut key "Ctrl+C" to copy the characters, and then press the shortcut key "Ctrl+V" to paste the characters to the new layer 1. After hiding the "background" layer, people can be seen, as shown in figure 12. As we can see from Figure 5, the details of the characters, especially the complicated hair parts, are also handled very well. 5. Finally, choose a beautiful background picture, put people in it, and trim the brightness, size and position of people, especially the edge details such as hair, which can be processed with fuzzy tools. Click the "Filter → Blur → Gaussian Blur" command in the menu bar to open the Gaussian Blur Filter dialog box and set the blur parameters, which will make the characters look more natural and the final effect will come out.

Fourth, the filtering method-a powerful extraction filter.

Mastering the first three methods skillfully, people in photos can basically be easily picked out, especially the details, which can be handled well by using the method of quick mask editing. However, in some cases, the effect of using masking technology to manage the edges of hair and skin is still not ideal. In this case, we can consider using the filtering method. By using the extraction filter, we can accurately mine the characters.

Knowledge tip: Compared with the first three tools, the extraction filter provides more professional and powerful tools and parameters. Pull-out filter is an advanced method to isolate foreground objects and clear the background on the layer. Even if the edge of the object is subtle, complex or uncertain, it can be cut and pasted from the background without much operation, and the tools in the extraction dialog box can also specify the part of the extracted image. The main step is to mark the edge of the object and fill in the part to be preserved. You can preview it and then modify the extracted effect.

Let's look at a photo first.

As can be seen from this photo, its background color looks similar to the color of the characters' clothes, and the hair is messy. If you want to dig it out of the background accurately, you might as well use an extraction filter.

1. Open the photo in Photoshop, and then click Window → Layers in the menu bar or press the shortcut key F7 to open the Layers panel. Right-click the background layer and select the "Copy Layer" command in the pop-up shortcut menu to create a "background copy" layer. Then, after confirming that the background copy layer is the currently edited layer, click the "Filter → Extract Filter" command in the menu bar to open the filter extraction dialog box, as shown in figure 19.

On the left side of the dialog box are some tool buttons for extracting filters, which are edge highlighting tool, filling tool, eraser tool, pipette tool, cleaning tool, edge decoration tool, zoom tool and gripper tool from top to bottom. On the right side of the dialog box is the parameter setting of the extraction filter. Due to space reasons, I won't explain too much here.

2. After understanding the meaning of each component of the extraction filter, we begin to operate on the characters. Click the Zoom tool to enlarge the image of the person, and then click the Edge Highlighter tool. At the same time, adjust the value of the "brush size" parameter on the right side to be smaller, which is helpful for smearing human hair. You can erase the wrong part with the eraser tool. First, smear the outline of the character's edge. After drawing, click the Fill Tool in the toolbar on the left to fill the character's skin. . At this time, click the "Preview" button on the right side of the dialog box, and you can quickly see the extracted renderings in the preview window. 3. After setting the above operations, click "OK" in the dialog box to exit the "Extraction" filter. At this point, we can hide the "background" layer and make the "background copy" layer appear by clicking the "eye" sign on the left side of the "background" layer in the layer panel, so that we can see the effect of the operation we just used the "extraction" filter.

4. Finally, open a background picture with Photoshop, copy and paste it into the original file, and automatically generate a new layer 2. After adjusting the size, position, brightness and other parameters of people and background, the final effect will come out, as shown in Figure 2 1.

3. After setting the above operations, click "OK" in the dialog box to exit the "Extraction" filter. At this point, we can hide the "background" layer and make the "background copy" layer appear by clicking the "eye" sign on the left side of the "background" layer in the layer panel, so that we can see the effect of the operation we just used the "extraction" filter.

4. Finally, open a background picture with Photoshop, copy and paste it into the original file, and automatically generate a new layer 2. After adjusting the size, position, brightness and other parameters of people and background, the final effect will come out, as shown in Figure 22, and it will be trimmed with the eraser tool.