Judging a matte on a white page when the cut-out will land on a dark background, where every fringing error becomes obvious.
AI and on-device processing
Image matting
Also called alpha matting, natural image matting or trimap matting. Here is what it means, when it changes what you export, and what people get wrong.
The short answer
Image matting works out how transparent every pixel along an edge is, and what colour the subject would be there without the background showing through. Instead of a yes or no mask it produces a continuous alpha value per pixel, which is what makes hair, fur and glass composite cleanly.
Updated
The short version
Image matting at a glance
| Quick fact | Detail |
|---|---|
| Output | Continuous alpha per pixel, plus foreground colour |
| Compositing equation | I = aF + (1 - a)B |
| Unknowns per pixel | Seven, from three measurements |
| Classic input hint | Trimap: foreground, background, unknown |
| Best on | Hair, fur, smoke, glass, veils, motion blur |
| Stored in | The alpha channel of an RGBA image |
Slide the table sideways to see every column.
What equation is matting actually solving?
Every pixel you photograph is a blend. The camera records one colour, but along a soft edge that colour is part subject and part background, mixed in some proportion. Matting formalises this as the compositing equation, written I = aF + (1 - a)B, where I is the pixel you can see, F is the true foreground colour, B is the background colour, and a is alpha, the fraction of that pixel covered by the subject.
A matting model estimates a for every pixel, and good ones estimate F as well. That second output matters more than people expect: it is what stops the old background tinting the strands of hair you kept.
Why is matting harder than segmentation?
Count the unknowns. Each pixel gives you three measured numbers, red, green and blue. To solve the compositing equation you need seven: three for the foreground colour, three for the background colour, and one for alpha. Three equations, seven unknowns, so the problem is under-constrained and has no single correct answer from the pixel alone.
Segmentation avoids this entirely by refusing to answer it. It picks a side per pixel and moves on. Matting has to lean on priors, neighbouring pixels and learned statistics about how real edges behave, which is why matting models are fussier, slower and much more sensitive to input quality.
What is a trimap, and do you still need one?
A trimap is a three-value hint map: definitely foreground, definitely background, and unknown. It shrinks the problem to a narrow band along the edges, where the solver only has to work out alpha inside the unknown strip. Classical matting depended on a good trimap, and drawing one by hand is tedious.
Trimap-free models generate that structure internally, usually by running a coarse segmentation first and treating the boundary region as the unknown band. They are far more convenient and handle most photos well. On genuinely hard images, wispy hair against clutter, a hand-drawn trimap still beats an automatic one.
Which subjects really need matting rather than a mask?
Anything where the edge is not an edge but a transition:
- Hair and fur, where individual strands are thinner than a pixel
- Smoke, steam and flames, which are semi-transparent throughout
- Glass, acrylic and clear packaging, where the background is genuinely visible through the subject
- Veils, lace, mesh and knitwear, with holes too small to resolve
- Motion-blurred limbs, where the edge is smeared over many pixels
For a hard-edged product on a plain backdrop, a clean mask is often enough. The moment a subject has any of the above, a mask alone will look cut out with scissors.
What people get wrong about image matting
Each one is a real failure mode, not a style preference.
Skipping foreground colour estimation, so kept hair strands still carry a tint of the background they were shot against.
Running matting on a small, heavily compressed copy, since compression smears exactly the boundary pixels matting depends on.
Expecting a matte to invent detail that motion blur or low resolution never captured in the first place.
Questions people ask
Image matting, answered
The follow-up questions people search for once they have the definition.
What is the difference between a mask and a matte?
A mask is binary: each pixel is in or out. A matte is continuous: each pixel carries a coverage value anywhere between fully transparent and fully opaque. Masks are fine for hard-edged shapes. Mattes are what you need whenever an edge is soft, blurred or partly see-through.
Why do my cut-outs have a grey or coloured fringe?
Because the boundary pixels kept some of the old background colour. Alpha was solved but the foreground colour was not, so a mid-tone rim survives. Proper matting estimates the unmixed foreground colour, and most tools call this step decontamination or spill suppression.
Can matting handle a glass bottle?
Partly. Matting can express that a pixel is semi-transparent, which is the right model for glass, but it cannot separate refraction and reflection from the object itself. Expect a usable result on a plain backdrop and manual correction on a busy one.
Does a better trimap really improve the result?
Yes, noticeably. A tight trimap tells the solver exactly where it is allowed to be uncertain, so it spends its effort on the strands rather than on regions that were never in doubt. Wide, sloppy unknown bands are a common cause of soft, mushy edges.
Same cluster
More from the glossary
Neighbouring entries, so every term in the set is one hop from every other.
Image metadata
Image metadata is the information stored inside an image file about the image rather than in the pixels: camera settings, dates, location, captions, credit, keywords and colour profile.
ICO
ICO is the Windows icon format, a small container that holds several sizes and colour depths of the same image inside one file.
Image noise
Image noise is the random speckle in a photo that does not correspond to anything in the scene.
From the studio
Tools that do this
Each one runs on your own device, so the photo stays where it is.
Keep reading
Elsewhere on Photomop
Platform image rules
Image size, file type and background rules for 22 selling platforms, each one sourced.
Read itConvert image
JPG, PNG, WebP and AVIF, with an honest answer about HEIC and alpha.
Read itAll the tools
The whole toolbox in three families, with what each one needs before it can run.
Read itOn-device privacy
The pipeline in five steps, what leaves your device, and how to check it yourself.
Read it
Now do it to a photo
Photomop is a photo studio that runs on your own device. Resize, crop, compress, convert, batch edit, remove a background and change one all work in the browser tab you are reading this in, at full resolution and with no watermark. The on-device page shows you how to check that the photo stays put.