A résumé needs white, an exam application needs blue, a visa might need red. Here is the complete ID-photo background workflow — cut out the person, replace the color, clean up the edge — in six steps, with the color values for blue, white and red and an edge that doesn't look cut out.
1. Before you start
You need a clean digital ID photo. A resolution of 300 dpi or more is recommended, at one- or two-inch size (you can crop later). Backgrounds are usually white, blue or red, chosen by purpose: white (passport, visa), blue (graduation certificate, work badge), red (marriage certificate, health insurance). In this tutorial we use the most common case — changing a white background to blue.
2. Step by step
Step 1: Open the file and duplicate the Background layer
Start Photoshop and choose "File" > "Open" to select your ID photo. In the Layers panel the Background layer is locked. To protect the original, press Ctrl+J to duplicate it into "Layer 1". Everything from here happens on Layer 1; you can hide the Background layer or leave it as a backup.
Note: if you use www.zaixianps.cc, the online PS layout is almost identical to the desktop version and supports the same layer-duplication shortcut.
Step 2: Build a selection around the subject
An accurate selection is what makes or breaks a background swap. Here are the two mainstream approaches:
- Method A: Quick Selection tool (for simple backgrounds). Select the Quick Selection tool in the toolbar (shortcut W), adjust the brush size (the [ and ] keys) and paint over the subject. Important: paint only on the person, never on the background. If the selection spills over, hold Alt and paint back to correct it.
- Method B: Pen tool (for complicated edges or industry-grade precision). Press P for the Pen tool and click along the subject's edge to add anchor points; for curves, drag to create Bezier handles. When you finish, right-click and choose "Make Selection" with a feather radius of 0.5 pixels.
For ID photos, Quick Selection is usually good enough — especially when the background contrasts with the subject. If the background is busy, trace the rough outline with the Pen tool first, then correct it with Quick Selection.
Step 3: Refine the selection edge (hair and other details)
With the selection made, click the "Select and Mask" button in the options bar (or choose Select > Select and Mask). Pick the Refine Edge brush on the left (the second icon) and paint along the hair edges; Photoshop recognises the edge automatically.
- View mode: choose "Overlay" or "Black & White" to see exactly where the selection boundary falls.
- Edge detection: tick "Smart Radius" and set it to 2-5 pixels.
- Global adjustments: Smooth 2-3, Feather 0.5-1, Contrast 10-15, and Shift Edge inward by 1-2 pixels (to remove the background color fringe).
In Output Settings choose "Selection" or "Layer Mask". If you choose Layer Mask, the result becomes a masked layer on exit, which keeps the edit non-destructive. Click OK.
Small tip: for wispy hair, run Select and Mask several times and change the brush size until you're happy with the result.
Step 4: Add a background layer and fill it with color
Make sure the subject selection is active (if you used a mask, you don't need to reload the selection every time). Click the "Create new layer" button at the bottom of the Layers panel (or press Ctrl+Shift+N), then drag the new layer below the subject layer (order: subject on top, background below).
Set the foreground color to the background color you need — for example R:0 G:56 B:168 (the standard ID-photo blue). With the new layer selected, press Alt+Delete to fill with the foreground color, or use the Paint Bucket tool (G) and click the canvas. The subject is now surrounded by the new background color.
Key point: if the selection is still active, press Ctrl+D to deselect after filling.
Step 5: Clean up the edge
Once the new background is in, look closely at the subject's edge — there is usually leftover hair or semi-transparent pixels from the old background. Here are a few ways to fix it:
- Use a layer mask (best practice): if you haven't made one yet, add a mask to the subject layer (select the layer, click "Add layer mask" at the bottom of the Layers panel). Then brush lightly along the edge with a black brush (20%-50% opacity) to kill the halo, and use a white brush to restore anything you erased.
- Use the Defringe command: choose Layer > Matting > Defringe and set the width to 1-2 pixels to remove color fringing.
- Create a clipping mask: add a Hue/Saturation adjustment layer above the subject layer (clipped to it), switch on "Colorize" and shift the hue toward the background color so the edge blends in.
This step takes patience, but Photoshop gives you several tools you can combine.
Step 6: Save, export and crop
Once the details are right, crop to the standard ID ratio with the Crop tool (C). A one-inch photo is 25 mm wide × 35 mm high (295 × 413 pixels @300 dpi); two-inch is 35 × 49 mm (413 × 579 pixels). Set width, height and resolution in the Crop tool's options bar.
To export, choose "File" > "Export" > "Export As" or press Ctrl+Shift+Alt+S. Choose JPEG and set quality to maximum (12). Name the file "ID_photo_blue.jpg". If you don't want the background baked in, you can also save as PNG (which keeps transparency — hide the background layer first).
If you work on www.zaixianps.cc, cropping and exporting are supported too, with exactly the same workflow.
Tips
- Swap the background color quickly: when you fill the background layer you can also use Layer > New Fill Layer > Solid Color, which makes changing the color later much easier.
- For ID photos shot on pure white, use Select > Color Range to sample the white background, invert the selection and create a mask straight away — much faster.
- When using the online PS tool (www.zaixianps.cc), if the browser stutters, close other tabs or switch to Chrome.
- If the subject's clothing is close in color to the target background, nudge the clothing color with a Hue/Saturation adjustment layer first, then correct it back after the swap.