| name | remove-background |
| description | Remove backgrounds from images using rembg. Use when user has images with backgrounds that need to be transparent, wants to batch process images, or needs PNGs with alpha channels. |
| triggers | ["remove background","transparent background","remove bg","rembg","make transparent","batch background removal","png with transparency"] |
| version | 1.0.0 |
Remove Background
Batch remove backgrounds from images using rembg (Python library).
When This Skill Activates
- User says "remove background", "make transparent"
- User has images that need transparent backgrounds
- User wants to batch process multiple images
Prerequisites
rembg must be installed:
pip install rembg
pipx install rembg
Verify installation:
rembg --version
How To Use
Single Image
rembg i INPUT.png OUTPUT.png
Batch Process Directory
IMPORTANT: Never output to the same file - use a separate output directory to avoid corruption.
mkdir -p backup && cp *.png backup/
mkdir -p processed
for img in *.png; do
echo "Processing: $img"
rembg i "$img" "processed/$img"
done
mv processed/*.png . && rmdir processed
Process Entire Folder (rembg native)
rembg p INPUT_DIR OUTPUT_DIR
Output Format
- Input: Any image (PNG, JPG, WEBP)
- Output: PNG with RGBA (alpha channel for transparency)
Example Workflows
Web Assets
cd ~/projects/my-app/public/images
mkdir -p transparent
for img in *.png; do rembg i "$img" "transparent/$img"; done
Product Photos
cd ~/products/photos
mkdir -p cutout
rembg p . cutout/
Models Available
rembg supports different AI models:
| Model | Quality | Speed | Use Case |
|---|
| u2net (default) | Good | Fast | General purpose |
| u2net_human_seg | Better | Medium | People/portraits |
| silueta | Good | Fast | Similar to u2net |
| isnet-general-use | Best | Slower | Complex backgrounds, pixel art, illustrations |
Recommended for pixel art/illustrations: isnet-general-use
Specify model:
rembg i -m isnet-general-use input.png output.png
Troubleshooting
| Issue | Solution |
|---|
| Empty output file | Don't use same input/output path - use separate folder |
| Slow first run | Model downloading, wait for it |
| Memory error | Process fewer images at once |
| Poor quality | Try different model with -m flag |
Pro Tips
- Always backup before batch processing
- Process to separate folder first, verify, then replace
- Use
-a flag to keep alpha if image already has transparency
- Post-process in image editor for fine edges if needed