Free

Free coded apps to suit all. No sign up, no email, usable offline, updates when I can, feedback welcome. Send feedback

How-to

How to cut out hair cleanly in a photo

Refine Edge in Paint by Zaweba has a Refine Brush for hair that works out soft edges by alpha matting, giving clean cut-outs of people and pets.

How to cut out hair cleanly in a photo

To cut hair out cleanly, make a rough selection of the person and then refine the edge. In Paint by Zaweba you do that in Select > Refine Edge, which has a Refine Brush made for hair: brush over the wispy parts and the edge under the brush is worked out by alpha matting, so fine strands keep their partial transparency instead of being chopped off. A separate Refine Edge Brush does the same along an existing selection's edge.

Hair is hard because it isn't a clean line. Single strands are thinner than a pixel, and the background shows through them. A hard edged selection either clips the strands or keeps a halo of the old background, which is why cut-outs of people so often look pasted on.

What you need

A photo with reasonable contrast between hair and background helps a great deal. Dark hair against a pale wall is far easier than brown hair against brown leaves. Paint by Zaweba runs offline on Windows, and the matting is classical maths rather than an online AI service, so the photo stays on your PC.

Step by step

First make a rough selection of the subject. Any selection tool will do, as long as it covers the body and face well and gets roughly to the edge of the hair. Don't fuss over the strands yet.

Then choose Select > Refine Edge. This opens a workspace of its own with seven ways to view the selection, which matters more than it sounds. View the cut-out on black, then on white, then on a colour unlike the original background. Each view shows different faults.

Pick the Refine Brush and paint along the hair, covering the area where strands meet the background. Keep the brush wide enough to take in both some hair and some background. The edge under the brush is recalculated so that each pixel gets the right amount of transparency. Work round the head in a few passes rather than one big sweep.

The workspace also has Quick Selection, a Brush and a Lasso for fixing the solid parts, plus edge settings for the outline as a whole. When it looks right, choose an output. There are six, including a new document and a new document with a layer mask. The mask options are the safest, because nothing is deleted.

Refine Edge works on a copy up to 1600 pixels across so that it stays responsive, then refines at full size when you press OK. If the preview looks a touch soft on a very large photo, that is why, and the final result is made at full resolution.

Touching up afterwards

The Refine Edge Brush is for later, when you already have a selection. Paint along its edge and the edge under the brush is worked out again by alpha matting. Hold Alt as you paint to make a part crisp again, which is useful where hair meets a shoulder or a collar and you want a clean line.

If you chose a layer mask output, you can also paint on the mask directly. White shows, black hides, and soft grey brushes blend the two, so a stray patch can be put back or taken away without redoing the selection.

Getting a good result

Check the cut-out on the background you will actually use. A strand that looks perfect on white may show a faint fringe on a dark backdrop. Zoom in to the outer strands and look for colour from the old background, and if a few ends refuse to behave, it is often better to let them go than to keep a ghostly fringe. Real hair photographed against a new background rarely shows every strand anyway.

Other ways to do it

For a product on a plain background, Paint by Zaweba also has one-click plain background removal, which builds the mask for you. You can then use Refine Edge only on the difficult parts. For a person, a rough selection finished with the Refine Brush is usually the quickest route to hair that looks real.