rembg (library)
Removes image backgrounds with segmentation models through local batch workflows, Python and an HTTP API.
Description
rembg is a tool for removing backgrounds from images. It accepts image files or bytes, applies a selected segmentation model, and returns a processed image or a mask. It can be used from the command line, as a Python library or as an HTTP server, including in Docker. It supports processing individual files or entire folders and offers alpha matting to refine edges. An online shop, for example, can batch-process product photos, save versions with transparent backgrounds, and pass them to a graphics template. Results around complex boundaries should be checked manually. The rembg code is MIT-licensed and local processing needs no subscription. Performance depends on the model and CPU or GPU; model weights have separate licenses, some requiring a paid agreement for commercial use. Optional cloud backends have independent terms and send images to their providers.