Loading...
Loading...
Compare original and translation side by side
| User Says | What Happens |
|---|---|
| "Remove the background from this photo" | AI removes background, outputs PNG |
| "Make this image transparent" | Removes background, preserves subject |
| "Cut out the product from this image" | Isolates subject with clean edges |
| "Remove backgrounds from all images in /photos" | Batch processes multiple images |
| "Quick background removal, white background" | Uses fast built-in method |
| 用户指令 | 执行操作 |
|---|---|
| "移除这张照片的背景" | AI移除背景,输出PNG文件 |
| "将这张图片设为透明背景" | 移除背景,保留主体 |
| "将这张图片中的产品抠出来" | 分离主体,边缘清晰 |
| "移除/photos目录下所有图片的背景" | 批量处理多张图片 |
| "快速移除背景,白色背景" | 使用快速内置方法 |
rembgpip install rembg
# Or with GPU acceleration (faster, requires CUDA)
pip install rembg[gpu]Pillowpip install Pillowrembgpip install rembg
# 或安装带GPU加速版本(速度更快,需要CUDA支持)
pip install rembg[gpu]Pillowpip install Pillow| Method | Description | Best For |
|---|---|---|
| rembg | AI-based using U2-Net model | Complex images, photos, products (default) |
| builtin | White-to-transparent conversion | Icons, graphics with clean white backgrounds |
| 方法 | 说明 | 适用场景 |
|---|---|---|
| rembg | 基于U2-Net模型的AI处理方式 | 复杂图片、照片、产品图(默认方法) |
| builtin | 白色背景转透明 | 图标、带有干净白色背景的图形 |
AskUserQuestion"Which image(s) should I remove the background from?Please provide the file path or paste the image."
"Which removal method?
- AI (rembg) - Best quality, works on any image (default)
- Built-in - Faster, best for white backgrounds"
"Where should I save the result?
- Same location with
suffix (default)_nobg- Custom path"
AskUserQuestion"需要移除哪张/哪些图片的背景?请提供文件路径或粘贴图片。"
"选择哪种移除方法?
- AI(rembg)- 效果最佳,适用于所有图片(默认)
- 内置方法 - 速度更快,适用于白色背景图片"
"结果保存到哪里?
- 与原文件同目录,文件名添加
后缀(默认)_nobg- 自定义路径"
python3 ${SKILL_PATH}/skills/background-remove/scripts/background_remove.py \
-i "/path/to/image.jpg" \
-o "/path/to/output.png"python3 ${SKILL_PATH}/skills/background-remove/scripts/background_remove.py \
-i "/path/to/img1.jpg" "/path/to/img2.png" "/path/to/img3.webp" \
-o "/path/to/output_folder"python3 ${SKILL_PATH}/skills/background-remove/scripts/background_remove.py \
-i "/path/to/icon.png" \
-m builtinpython3 ${SKILL_PATH}/skills/background-remove/scripts/background_remove.py \
-i "/path/to/image.jpg" \
-o "/path/to/output.png"python3 ${SKILL_PATH}/skills/background-remove/scripts/background_remove.py \
-i "/path/to/img1.jpg" "/path/to/img2.png" "/path/to/img3.webp" \
-o "/path/to/output_folder"python3 ${SKILL_PATH}/skills/background-remove/scripts/background_remove.py \
-i "/path/to/icon.png" \
-m builtin| Parameter | Short | Description | Default |
|---|---|---|---|
| | Input image path(s) | Required |
| | Output path or directory | Auto-generated with |
| | Removal method (rembg, builtin) | rembg |
| 参数 | 简写 | 说明 | 默认值 |
|---|---|---|---|
| | 输入图片路径(可多个) | 必填 |
| | 输出路径或目录 | 自动生成,添加 |
| | 移除方法(rembg, builtin) | rembg |
| Extension | Format | Notes |
|---|---|---|
| PNG | Best quality, larger file (default) |
| WebP | Good compression, modern format |
| 扩展名 | 格式 | 说明 |
|---|---|---|
| PNG | 画质最佳,文件体积较大(默认) |
| WebP | 压缩效果好,现代图片格式 |
import sys
sys.path.insert(0, "${SKILL_PATH}/skills/background-remove/scripts")
from background_remove import remove_background
result = remove_background("/path/to/image.png", "/path/to/output.png", method="rembg")
if result.get("success"):
print(f"Saved to: {result['file']}")
else:
print(f"Error: {result['error']}")import sys
sys.path.insert(0, "${SKILL_PATH}/skills/background-remove/scripts")
from background_remove import remove_background
result = remove_background("/path/to/image.png", "/path/to/output.png", method="rembg")
if result.get("success"):
print(f"已保存至: {result['file']}")
else:
print(f"错误: {result['error']}")python3 ${SKILL_PATH}/skills/background-remove/scripts/background_remove.py \
-i "/path/to/image.png" \
-o "/path/to/output.png" \
-m rembgpython3 ${SKILL_PATH}/skills/background-remove/scripts/background_remove.py \
-i "/path/to/image.png" \
-o "/path/to/output.png" \
-m rembgrembg not installed. Install with: pip install rembg[gpu] (or pip install rembg for CPU-only)Image not found: /path/to/image.png未安装rembg。请执行以下命令安装:pip install rembg[gpu](或pip install rembg仅支持CPU版本)图片未找到: /path/to/image.pngrembg[gpu]rembg[gpu]python3 ${SKILL_PATH}/skills/background-remove/scripts/background_remove.py \
-i "product_photo.jpg" \
-o "product_transparent.png"python3 ${SKILL_PATH}/skills/background-remove/scripts/background_remove.py \
-i "product_photo.jpg" \
-o "product_transparent.png"python3 ${SKILL_PATH}/skills/background-remove/scripts/background_remove.py \
-i photos/*.jpg \
-o "transparent_photos/"python3 ${SKILL_PATH}/skills/background-remove/scripts/background_remove.py \
-i photos/*.jpg \
-o "transparent_photos/"python3 ${SKILL_PATH}/skills/background-remove/scripts/background_remove.py \
-i "icon.png" \
-m builtinpython3 ${SKILL_PATH}/skills/background-remove/scripts/background_remove.py \
-i "icon.png" \
-m builtinpython3 ${SKILL_PATH}/skills/background-remove/scripts/background_remove.py \
-i "photo.jpg" \
-o "result.webp"python3 ${SKILL_PATH}/skills/background-remove/scripts/background_remove.py \
-i "photo.jpg" \
-o "result.webp"