rembg rembg removes the background from an existing photo using a segmentation model. For product catalogs, it lets you create a PNG with transparency or an image on a solid-color background, and process individual images or entire folders. Edge quality, product detail preservation, and marketplace compliance should be evaluated separately: having a finished file does not automatically mean the listing is ready to publish.
Prepared by Vladimir Lomtev’s AI Studio on November 11, 2026, for e-commerce content managers, photographers, and catalog developers. Below are standalone answers to one task: preparing a product that has already been photographed. Generating a new scene and changing the product’s appearance are not covered here.
Based on the official documentation and source code for rembg 2.0.87. We did not run background removal on photos or measure speed or accuracy. The commands below are documented examples for testing in your own environment. The version was cross-checked against the package page on PyPI; command behavior was verified against the files in the corresponding release.
Contents
- What exactly does rembg do to a product photo?
- Does rembg work locally, and do you need the internet?
- What do you need to install to get rembg commands?
- How do you create a PNG with a transparent background from a single image?
- How is a transparent background different from a white one, and how do you make it white?
- How do you process a folder, and why might some photos be missing from the output?
- What should you do about halos and uneven edges?
- Can you use rembg free of charge for a commercial catalog?
- Can you upload the result directly to a marketplace or embed it in a catalog?
What exactly does rembg do to a product photo?
The model determines which areas of the image to keep and which to make transparent. The resulting mask describes which pixels belong to the foreground; the alpha channel sets their transparency in the final file. Semi-transparent values are needed for a soft edge, not just for fully removing the background. rembg offers several models and edge-handling methods. Project and model description.
For example, in a backpack photo, the wall and table can be removed while leaving the body, straps, and handle. But the program does not know your store’s assortment: a strap, tag, or included case may be treated as background. So compare the cutout with the source image, especially if losing a detail changes how the product is perceived.
If the task is to create a new advertising scene, you need a different process. That is covered in the article on AI image generation. For background removal, the product’s original characteristics must already be visible in the photo.
Does rembg work locally, and do you need the internet?
Local processing is possible when you choose a local model. Its weights are downloaded automatically the first time you use it; after that, they are stored on your computer. However, the same interface also offers cloud processors withoutbg and atlascloud: when you choose them, images are sent to an external service. The name rembg by itself does not mean the photos stay inside your company. Models and weight storage.
For the reproducible example below, u2net is explicitly selected. This is not a claim that it is better than other models for your products. The network is needed to install dependencies and download the weights initially; use in a fully isolated environment should be checked separately after setup. Do not transfer a promise of "local" processing to someone else’s website or demo web interface, even if it uses the same library.
For confidential photos of new collections, first find out which processor your script calls and where it is running. A local CLI, your company’s server, and a public service are different data paths.
What do you need to install to get rembg commands?
For the command line, you need the dependency set with the cli extra; for CPU processing, use cpu. The README for the release reviewed here specifies Python from 3.11 up to, but not including, 3.14. PyPI metadata sets a wider upper bound, so this example uses Python 3.12 from the overlap of those requirements. Release installation and requirements.
Example for a Linux or macOS terminal where the python3.12 command is already installed:
python3.12 -m venv .venv-rembg
source .venv-rembg/bin/activate
python -m pip install "rembg[cpu,cli]==2.0.87"
rembg --help
The sign that this stage is complete is the rembg help output with available subcommands, not just a successful pip message. If rembg is not found, check that you activated the same environment where you installed the package. On Windows, creating and activating the environment is different; do not copy the shell commands there as-is.
A graphics card is not required for the CPU version. GPU installation requires a compatible ONNX Runtime and its system dependencies; it is not as simple as having any GPU at all. A GPU setup and speedup claims are not covered here.
How do you create a PNG with a transparent background from a single image?
The i subcommand takes one input file. Prepare a copy of the photo named SKU-104-front.jpg and run the example from the folder where it is located:
rembg i -m u2net SKU-104-front.jpg SKU-104-front-cutout.png
The input is an existing photo, and the output is a new PNG. The first time you access this model, the weights may be downloaded. The model name is set explicitly, so the result does not depend on which processor is the default in another version. The format and argument order are confirmed by the source code for the i command.
Open the output file in an editor that shows transparency, and place it over a light and a dark background in turn. A good result for further work keeps all the needed product, leaves no large background islands, and does not cut off details. These are suggested visual-check criteria; the command was not executed for this article.
A white background in the viewer proves nothing by itself: the viewer may simply display transparent areas as white.
How is a transparent background different from a white one, and how do you make it white?
A transparent PNG contains transparency information. A white background is visible white pixels under the object. For a designer, it is convenient to keep a transparent master file and prepare a separate derivative version for a specific storefront. That way, a change in styling does not require cutting out the product again.
In rembg, the background color is set with the -bgc parameter and four integer RGBA values: red, green, blue, and opacity. In the example, all values are 255, which produces an opaque white background:
rembg i -m u2net -bgc 255 255 255 255 SKU-104-front.jpg SKU-104-front-white.png
The parameter is in the description of the i command in the source code. It sets the background, but it does not fix a bad mask: if the backpack handle has already been cut off, a white fill will not restore it.
When choosing a file, it helps to separate the purpose:
| File | What’s stored | When to use it |
|---|---|---|
| Original photo | Product and original background | Reprocessing and detail checks |
| Transparent PNG | Cut-out object and alpha channel | Design, layout, different backgrounds |
| PNG on white | Object on an opaque white background | Preparing a version for the storefront |
| JPEG on white | Image without an alpha channel | When the target channel requires JPEG |
A standard JPEG does not store an alpha channel; simply renaming .png to .jpg does not convert the file. First flatten the object onto the chosen background, then export to JPEG. Supported JPEG and PNG modes are described in the Pillow format documentation.
How do you process a folder, and why might some photos be missing from the result?
For folders, p is used. Prepare the input folder photos-in in advance, and place the output folder photos-cutout next to it, outside the input tree:
rembg p -m u2net photos-in photos-cutout
The command has an important quirk: in release 2.0.87 it walks the input subfolders, but it builds the output name only from the file name, replacing the extension with .png. The subfolder structure is not preserved in the output. If that output PNG already exists, processing of the corresponding input is skipped. Errors for individual files are printed, after which the loop may continue. You can see this in the implementation of the p command.
So red/front.jpg and blue/front.jpg both compete for the same front.png. Likewise, SKU-104.jpg and SKU-104.png conflict. You should not use traversal order as a way to choose the needed version: the second file may be skipped because the result already exists.
For a product catalog, it’s safer to include the SKU, variation, and angle in the file name ahead of time: for example, SKU-104-red-front.jpg and SKU-104-blue-front.jpg. Use a new output folder when changing the model or settings: otherwise, existing PNGs may remain from the previous run. Keep the originals separately and do not enable the option to delete input files for a trial run.
A batch is complete when the expected list of names matches the actual files, and then the images themselves are checked. A filled progress bar does not confirm that every product received a correct result. These rules follow from how the command works; the real catalog in the article was not processed.
What should you do about a halo and an uneven edge?
First determine what is actually damaged. A color fringe from the original background and an incorrect object outline require different actions. The README distinguishes removing background color contamination -dc and refining the soft edge with -a, meaning alpha matting. Edge processing modes.
If the outline is generally correct but you can see the wall color along the fabric, you can try this variant:
rembg i -m u2net -dc SKU-104-front.jpg SKU-104-front-dc.png
If the mask roughly cut off the soft edge of the fabric, compare a matting variant separately:
rembg i -m u2net -a SKU-104-front.jpg SKU-104-front-matting.png
These are comparison options, not universal fixes. -dc changes the color of edge pixels while preserving the alpha channel; -a further refines the edge and already includes color contamination removal. There is no need to combine them for a presumed double effect. Compare the new files with the original cutout and the product itself. Color processing description.
If the entire strap disappeared or the model left in a stray object, changing the edge color will not solve the problem. You need a different mask, manual cleanup, or a different source photo. With clear glass and reflective packaging, check semi-transparent areas especially carefully: the photo already contains the light and reflections of the previous scene. You cannot promise a physically accurate transfer of such a product onto any background from a single automatic cutout.
Can rembg be used for free for a commercial catalog?
The software license and the selected weights must be considered separately. rembg itself is distributed under MIT. But in the release reviewed here, the default processor is bria-rmbg, and commercial use of the BRIA RMBG-2.0 weights requires a separate agreement. This is explicitly stated in in the BRIA model card and the rembg README.
In the examples, u2net is explicitly selected; its upstream project publishes the Apache 2.0 license. This is a basis for reviewing the terms of the selected project, not a general conclusion about any weights or any images. For a real commercial workflow, keep the source of the specific weights and their terms, and also verify the rights to the original photos. Installing the package for free does not create rights to someone else’s product photography.
This licensing note does not replace a legal review of the terms of your use. The article does not calculate total cost: equipment, editor labor, storage, and possible commercial agreements were not evaluated.
Can you upload the result directly to a marketplace or embed it in a catalog right away?
Automatic background removal prepares the image, but it does not confirm compliance with the rules of a specific platform. Separately check the current requirements for size, format, background, object placement, and card content. There is no universal set of numbers for all storefronts here.
For integration into your own catalog, rembg provides a Python interface. When processing multiple images, the documentation recommends creating one model session and passing it again into remove instead of creating a session for each file. Library usage examples. The integrator’s separate task is to keep the result linked to the SKU and angle, send unsuccessful cutouts to an editor, and avoid overwriting the original photo.
You can prepare the product card text independently of the images: for that, there is a guide to product descriptions from CSV in Dify. The final product card should describe the same variant and package shown in the photo.
How does Vladimir Lomtev’s AI studio help prepare catalog images?
When you need to connect photo processing with a working catalog, Vladimir Lomtev’s AI studio can prepare the data and image requirements, develop and test an MVP for processing, and integrate it with your business system. These activities relate to computer vision, data preparation, and integration; the specific tool and model are chosen based on the task.
The first step is to define one process: where the originals come from, how they are linked to SKUs, which defects the editor currently fixes, and by what criteria an image is considered usable. To start, it is enough to describe this process and its constraints. Discuss the project.
Bottom line: what result should you save for the catalog?
Keep the original photo and the transparent master, and create the white background and the required format as separate versions. In batch processing, exclude duplicate output names in advance and account for skipping existing PNG files. Choose the model explicitly so you understand the data path and the terms of its use.
You can start with one representative shot and one difficult one: compare detail preservation, edges on different backgrounds, and how well the file name matches the product. Only after that should you apply the chosen settings to the full batch. The result should be a file linked to the SKU, ready for further product card preparation.



