How to Remove a Photo Background Cleanly — AI Segmentation vs. Matting, Shooting and Touch-Up Tips

How AI background removal works (segmentation vs. matting), how to shoot for cleaner cutouts, fixing hair and transparent edges, and saving as PNG or white JPG.

Drop a photo into a background remover and within seconds only the person or object is left. Yet some photos come out cleanly while others end up with mushy hair or leftover bits of background. Most of this difference is explained once you know how the AI understands a photo. This article covers the principles along with shooting and touch-up tips that improve the results.

Segmentation and matting — two approaches

SegmentationMatting
OutputA "foreground / background" decision per pixel (a mask close to 0 or 1)The share of each pixel occupied by the foreground (an alpha value between 0 and 1)
Good atObjects with clear outlines, many kinds of thingsHair, fur, semi-transparent edges
Weak atHair and fur cut off in jagged stepsObjects outside what it was trained on (mainly people)
Representative researchU²-Net (salient object detection)MODNet (portrait matting)

Segmentation decides "does this pixel belong to the subject?" Salient object detection models such as U²-Net are trained to find the most eye-catching subject in a photo, so they're widely used for products, animals and objects.

Matting goes a step further and estimates "what percentage of this pixel is the subject?" A pixel that a single strand of hair passes through is a mix of hair and background, so it has to be represented by an in-between value like 0.3 to look natural. Originally, matting required a person to draw a map of "definite foreground / definite background / boundary" (a trimap), but models like MODNet that perform matting from a portrait alone, without a trimap, made automation possible.

In short, matting models generally do better for portraits, and segmentation models for products and objects. The Remove Background tool runs models of both kinds inside your browser, and your photos never leave your device.

What running AI in the browser means

Server-based background removal services take your uploaded photo and process it on a server GPU. Browser-based tools do the opposite: they download the model file and run it on your device. This approach has the following characteristics.

  • Privacy: photos never leave your device, so you can use it even for sensitive images such as IDs and family photos.
  • First-run wait: the model file has to be downloaded once at first. After that it stays in the browser cache.
  • Device performance matters: processing speed varies greatly with your device's CPU, GPU and memory. On older phones it can take tens of seconds.
  • Input size: these models usually shrink the photo to a fixed input of a few hundred pixels for inference, then scale the resulting mask up to the original size. So on very large photos, fine hair may not be separated as finely as in the original. The U²-Net paper also resized input images to 320×320 for training and evaluation.

Shooting for better results

In the end, the AI looks at "the difference between the subject and the background." The clearer the difference, the better the result.

  • Make the subject's color and brightness different from the background: a white shirt shot against a white wall makes the edge hard to find. Choose clothing and background with a large difference in brightness.
  • Keep the background simple: busy backgrounds like patterned wallpaper, bookshelves or tree branches can be partly misjudged as the subject.
  • Put distance between subject and background: standing at least 1m from the wall keeps shadows off the background and blurs it naturally, making the edge clearer.
  • Avoid backlighting and hard shadows: light coming from behind the head blends the edges of the hair with the background and causes glare. Soft light from the front or at 45° works well.
  • Focus and resolution: even AI can't accurately separate edges that are shaky or out of focus. Shoot so the subject is large enough in the frame.
  • One subject: with several people or objects, which one the model treats as the subject can vary.

Refining the edges

When the automatic result isn't perfect, touching it up with a brush is fastest.

  1. Erase leftover background: enclosed holes, such as between an arm and the body or between fingers, are often left behind. Clean them up with the eraser brush.
  2. Restore cut-off parts: if part of the body vanished into a background of similar color, bring it back with the restore brush.
  3. Soften the edges: if the edge is hard and jagged, softening it by 1–2 pixels blends it naturally with a new background.
  4. Check for color spill: photos taken in front of green grass can leave a green tint at the tips of the hair. Place it on a white background and zoom in to see it clearly.

It also helps to know the hard cases. Transparent or reflective objects like glasses and plastic wrap, eyeglass lenses that show the background, and thin bicycle spokes or fences are what current automatic models struggle with most.

Compositing naturally onto a new background

A cut-out person or object placed on another photo often looks off. The cause is usually light and color.

  • Match the direction of light. If the person was lit from the left but the sun in the new background is on the right, it looks wrong.
  • Clean up color spill at the edges. If the original background color remains at the tips of the hair, it shows up like an outline on the new background.
  • Add shadows. Objects touching the ground need a faint shadow under the feet or base so they don't appear to float.
  • Match sharpness and noise. Placing a smooth-looking person on a grainy background photo makes them look out of place.

Save format and background color

PurposeSave formatWhy
Compositing with other images, design assetsPNGLossless, full alpha channel support
Transparent images for the webWebPKeeps transparency and is much smaller than PNG
White-background product photos, document attachmentsJPG (filled with white background)Highest compatibility and small file size

JPG can't store transparency (MDN), so saving a transparent result as JPG fills it with the solid color you choose. If you need a white-background JPG, set the background color to pure white (#FFFFFF) when saving.

About white backgrounds for product photos

Some online marketplaces and shopping platforms have rules for main images, such as a white or solid background and no borders or text. However, the rules differ by platform and category and change often, so this article doesn't list figures for specific platforms. Check the latest image guidelines in the seller center before listing. Items worth checking on any platform:

  • Whether the background must be pure white (RGB 255, 255, 255) or light gray is also allowed
  • How much of the frame the product must fill, and the margins
  • Minimum pixel size, file size and format

After removing the background, adjust the margins and ratio with Crop, and if there's a file size limit, finish with Compress Image.

Don't use it for official ID photos

The Korean passport photo rules state that photos whose background has been removed or composited with editing software are not accepted. For detailed criteria, see ID and application photo sizes.

Frequently asked questions

If I save a background-removed photo as JPG, will it be transparent?

JPG can't store transparency, so transparent areas are filled with a solid color such as white or black. To keep a transparent background, save as PNG or WebP.

Can I change my ID photo background to white and submit it?

The Korean Ministry of Foreign Affairs does not accept passport photos whose background has been removed or composited with editing software. Photos for official submission should be taken against a white background from the start; background removal results are better used where no rules apply, such as social media profiles or design work.

Why does background removal take a while the first time?

Running an AI model in the browser requires downloading the model file (a few MB to tens of MB) once at first. After that it stays in the browser cache and starts faster, and your photos are never sent to a server.

Last updated: 2026-09-23

Sources

← Back to guides