RemoveBgPictureA PictureEditor.com tool

Guide

Hair, fur and everything else with a soft edge

Every argument about the quality of a cutout is really an argument about a strip of pixels a few wide. This is what happens inside that strip, stated plainly, including the parts where it does not work.

Three regions, not two

The first pass over a photograph produces a yes-or-no answer: subject, or not. That answer is useful and it is not enough, because a boundary drawn from it has to put every pixel on one side or the other, and a great many real pixels are genuinely both.

So the yes-or-no mask is turned into three regions. Shrink it inward by the band width and what survives is certainly subject. Grow it outward by the same amount and what lies beyond is certainly not. Between them sits a strip where no claim has been made — and that strip is where the second pass does its work, re-reading the photograph at its real resolution and working out, for each pixel in the band, how much of it is subject.

The three regions and what happens in each
RegionHow it is madeWhat the second pass does
Certainly subjectthe mask, shrunk inwardnothing — it stays fully opaque
The bandeverything in betweensolves a value for every pixel
Certainly groundoutside the mask, grown outwardnothing — it stays fully clear

What widening the band buys, and what it costs

A wider band is more pixels that are allowed to be partly there. On a portrait against a plain wall that is straightforwardly good: the flyaway strands above the crown, the fine edge of a knitted hat, the halo of an untidy fringe all survive at twelve or fourteen pixels where they vanish at two.

The cost arrives when the ground has structure of its own. The second pass does not know what a person is; it knows what contrast is. Hand it a fourteen-pixel strip that includes a bookcase edge and it will find that edge and honour it, which produces semi-transparent fragments of shelf hanging off someone’s hair. The rule of thumb is that band width should track how plain the ground is, not how hairy the subject is.

Why a green rim appears in front of a hedge

A pixel a strand crosses at an angle is a mixture. Perhaps a third of the light that reached it came off the hair and two thirds came off the hedge behind. Its recorded colour is that mixture, and when the alpha channel marks it as one-third present, the colour carried into the file is still two-thirds hedge.

Estimating the subject’s true colour in those pixels and subtracting the contribution from behind is a real technique with a real name, and it is not in this version. What is here is the take-away brush, which removes the rim by removing the pixels — effective, and it takes the strands inside the rim with it.

The edges nobody wins

  • Similar tone on both sides. Contrast is the only signal. Brown hair in front of brown shelving, a grey cat on a grey sofa, a white shirt against a white wall — the band has nothing to resolve and returns something close to the coarse mask.
  • Anything you can see through. Glass, bottles, veils, sheer fabric and smoke come back as opaque objects, because what is estimated is which pixels belong to the subject rather than how much light passed through them. Those are different questions and only the first is being asked.
  • Holes smaller than the band. Lace, netting and chain-link come back solid. The gaps are narrower than the strip the solve is working in, so they never become their own certainly-ground region.
  • Motion blur. A swinging arm has no edge anywhere — it has a gradient thirty pixels deep. The boundary lands somewhere inside it, and which somewhere is essentially arbitrary.

Questions about the band

Is a trimap something I have to make?
Not here. The three regions are derived for you — the mask is shrunk inward to make the certain-subject region, grown outward to make the certain-ground region, and what is left between them is the band. The edge detail slider is how wide that band is, which is the only part of the arrangement worth a control.
Why does the band cost more on a large photograph?
It does not, much, and that is deliberate. The boundary is solved in tiles with an overlap, so the working memory is set by the tile rather than by the picture, and a twelve-megapixel frame costs about the same per pixel as a two-megapixel one. What does change is the meaning of the number: eight pixels is a generous band on a small photograph and a hairline on a very large one.
The strands look right but the whole subject has gone slightly soft.
Feather is too high. It is a curve applied across the band, and at the top of its range it deliberately leaves the ramp long — which flatters hair and makes a shoulder look out of focus. Feather high with the band narrow is usually the combination you want on a mixed subject: soft where the boundary is genuinely soft, decisive where it is not.

Read next