rembg
Remove image backgrounds from the command line, Python or an HTTP server.
- Star 数
- 25.1K
- Fork 数
- 2.4K
- 未关闭 Issue
- 2
- 最近提交
- 2026-10-10
数据来自 GitHub API · 更新于 2026-10-15
rembg 是什么?
rembg removes backgrounds with models such as U²-Net, IS-Net and BiRefNet. Use it as a CLI, a Python library, an HTTP server or a Docker container — handy for batch-processing product photos.
主要功能
- CLI, Python library and HTTP server
- Multiple segmentation models (u2net, isnet, birefnet, sam)
- Batch folder mode and alpha matting
- Docker image
系统要求
- 平台
- Windows · macOS · Linux · Docker
- 显卡
- Optional (CPU works; install the gpu extra for CUDA)
- Python
- 3.10+
如何安装 rembg
根据项目 README 整理。开源项目更新很快,请以 GitHub 页面上的最新说明为准。
pip
- 1Install with the CLI extra (use [gpu,cli] for CUDA).
pip install "rembg[cpu,cli]" - 2Remove a background.
rembg i input.png output.png - 3Process a whole folder.
rembg p input_folder output_folder
Docker
- 1Run against files in the current directory.
docker run -v .:/data danielgatis/rembg i /data/input.png /data/output.png
优势
- Scriptable and fast
- MIT license
不足
- No GUI
- Hair and transparent objects can be imperfect
rembg 替代品对比
| 软件 | Star 数 | 许可证 | 平台 | 显存 |
|---|---|---|---|---|
| rembg Remove image backgrounds from the command line, Python or an HTTP server. | 25.1K | MIT | — | |
| BiRefNet High-resolution dichotomous segmentation — state-of-the-art background removal. | 4.3K | MIT | — | |
| IOPaint Erase objects, watermarks and people with AI inpainting (formerly Lama Cleaner). | 23.3K | Apache-2.0 | — | |
| Upscayl Free desktop app that upscales images with AI. | 50.6K | AGPL-3.0 | — | |
| Real-ESRGAN Practical image and video super-resolution models. | 37.1K | BSD-3-Clause | — | |
| GFPGAN Blind face restoration for old and low-quality photos. | 37.7K | Apache-2.0 | — |
常见问题
rembg 免费吗?
是的——rembg 是开源软件,采用 MIT 许可证。商用前请确认软件及模型权重的许可条款。
rembg 支持 Windows、Mac 和 Linux 吗?
rembg 支持:Windows, macOS, Linux, Docker。
运行 rembg 需要什么配置?
Optional (CPU works; install the gpu extra for CUDA)
如何安装 rembg?
1. Install with the CLI extra (use [gpu,cli] for CUDA). 2. Remove a background. 3. Process a whole folder.
rembg 有哪些好的替代品?
常见替代品包括 BiRefNet, IOPaint, Upscayl, Real-ESRGAN,详见本页对比表。
可以不安装、在线使用 rembg 吗?
如果只想要结果,AiLoft 可在浏览器中运行 GPT Image 2.5、Nano Banana Pro 等顶级图像模型,无需显卡和配置。
不想安装?直接在浏览器里生成图片
无需显卡、驱动或 Python。在线使用 GPT Image 2.5 和 Nano Banana Pro,并排对比效果。