Changing the background on an ID photo is one of those jobs that looks trivial until you zoom in. Hair, shoulders, and the gap between an arm and the body often keep bits of the old background, and a hard-edged cutout immediately looks fake. This Photoshop route uses Select and Mask to keep the fine edges intact, and it is simple enough to follow without much retouching experience.

Finished ID photo with a cleanly replaced background

Open the image and unlock the layer

Open your photo in Photoshop. If the layer is locked, unlock it first so you can work on it.

Unlocking the background layer in Photoshop

Select the subject

Choose Select > Subject. Photoshop will make a selection around the person in the photo.

Selecting the subject from the Select menu

Open Select and Mask

Right-click inside the selection and choose Select and Mask. A separate window opens. At this point the person may still have bits of background around the edges.

Choosing Select and Mask from the right-click menu

The Select and Mask workspace

Refine the edges

Choose the second brush from the toolbar on the left, set its size to match the edge you are cleaning, and paint along the person's outline. Work around hair and shoulders. The edge should look cleaner and stray background color should be reduced.

Refining the edge with the brush in Select and Mask

Decontaminate colors

Scroll the panel on the right all the way down, turn on Decontaminate Colors, then click OK. You will return to the main Photoshop window.

Turning on Decontaminate Colors and confirming the mask

Add a solid color background

At the bottom of the Layers panel, click the half-filled circle icon and choose Solid Color. Pick the background color you need in the color picker and confirm.

Choosing a Solid Color fill layer

Selecting the new background color

Move the color layer behind the subject

Drag the new solid color layer downward until it sits below the subject layer, shown as Background copy in this example. The old background disappears and the new color fills in behind the person. The hair and edges should stay natural, with no jagged pixels or fringe.

Dragging the color layer below the cutout layer

The replaced background with natural-looking hair and edges

Export the file

Go to File > Export > Quick Export as PNG. If you need another format, choose Export As instead, select the format you want, and confirm.

Exporting the finished photo as PNG