background-remove
Skill30 starsChanged 10 months agoMITView on GitHub
Remove backgrounds from images using AI. Triggers include: "remove background", "transparent background", "cut out", "isolate subject", "remove bg", "make transparent", "extract subject", "background removal" Creates PNG or WebP images with transparent backgrounds.
- Installs packages
We split this skill into the rules it gives an agent
5 rules. About 0 are common, 4 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈4
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 12
Remove backgrounds from images using AI (rembg/U2-Net) or built-in methods.
- Very specific: line 53
Use the AskUserQuestion tool for each question.
- Distinctive: line 167
Check if the image file is corrupted
- Distinctive: line 168
Ensure sufficient memory for large images
- Distinctive: line 174
Check edges: - If edges are rough, the AI method usually gives better results
≈ “Common” is an estimate: at least 1 in 5 of the 308,232 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Background Remove Skill
Remove backgrounds from images using AI (rembg/U2-Net) or built-in methods.
Output: PNG or WebP with transparent background.
Quick Examples
| 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 |
Prerequisites
rembg- AI-based background removal (recommended)pip install rembg # Or with GPU acceleration (faster, requires CUDA) pip install rembg[gpu]Pillow- Required for image processingpip install Pillow
The first run will download the U2-Net model (~170MB) which is cached for future use.
Methods
| 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 |
Workflow
Step 1: Gather Requirements (REQUIRED)
Use the AskUserQuestion tool for each question. Ask ONE question at a time.
Q1: Image Source
"Which image(s) should I remove the background from?
Please provide the file path or paste the image."
Wait for response.
Q2: Method (Optional)
"Which removal method?
- AI (rembg) - Best quality, works on any image (default)
- Built-in - Faster, best for white backgrounds"
Wait for response. Default to AI if user doesn't specify.
Q3: Output Location (Optional)
"Where should I save the result?
- Same location with
_nobgsuffix (default)- Custom path"
Wait for response.
Step 2: Execute Background Removal
Single image:
python3 ${SKILL_PATH}/skills/background-remove/scripts/background_remove.py \
-i "/path/to/image.jpg" \
-o "/path/to/output.png"Batch processing:
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"Using built-in method (faster for white backgrounds):
python3 ${SKILL_PATH}/skills/background-remove/scripts/background_remove.py \
-i "/path/to/icon.png" \
-m builtinStep 3: Deliver Result
- Show the result to the user
- Confirm the background was removed successfully
- Offer to:
- Process additional images
- Try a different method if quality isn't satisfactory
- Adjust output format (PNG vs WebP)
Script Parameters
| Parameter | Short | Description | Default |
--input | -i | Input image path(s) | Required |
--output | -o | Output path or directory | Auto-generated with _nobg suffix |
--method | -m | Removal method (rembg, builtin) | rembg |
Output Formats
The output format is determined by the file extension:
| Extension | Format | Notes |
.png | PNG | Best quality, larger file (default) |
.webp | WebP | Good compression, modern format |
Integration with Other Skills
This skill can be called by other skills that need background removal:
From Python (import)
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']}")From Command Line
python3 ${SKILL_PATH}/skills/background-remove/scripts/background_remove.py \
-i "/path/to/image.png" \
-o "/path/to/output.png" \
-m rembgError Handling
rembg not installed:
rembg not installed. Install with: pip install rembg[gpu] (or pip install rembg for CPU-only)The script will automatically fall back to the built-in method.
Image not found:
Image not found: /path/to/image.pngProcessing failed:
- Try a different method
- Check if the image file is corrupted
- Ensure sufficient memory for large images
Tips for Best Results
- Use rembg for photos - AI handles complex edges (hair, fur, transparent objects)
- Use builtin for graphics - Faster for icons/logos with clean white backgrounds
- Check edges - If edges are rough, the AI method usually gives better results
- Batch process - Process multiple images at once for efficiency
- GPU acceleration - Install
rembg[gpu]for faster processing on NVIDIA GPUs
Examples
Remove background from a photo
python3 ${SKILL_PATH}/skills/background-remove/scripts/background_remove.py \
-i "product_photo.jpg" \
-o "product_transparent.png"Batch process a folder
python3 ${SKILL_PATH}/skills/background-remove/scripts/background_remove.py \
-i photos/*.jpg \
-o "transparent_photos/"Fast removal for icons (white background)
python3 ${SKILL_PATH}/skills/background-remove/scripts/background_remove.py \
-i "icon.png" \
-m builtinOutput as WebP (smaller file size)
python3 ${SKILL_PATH}/skills/background-remove/scripts/background_remove.py \
-i "photo.jpg" \
-o "result.webp"Other versions1 project uses a version of this.
Word for word · 1
- allanjohny/parce★ 0100% same
Edited · 0
None found.
Wrote their own version · 0
None found.
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository45 other files it gives its agents.
- add-to-xcodeSkill
- android-to-iosSkill
- app-demo-agentSkill
- audio-producer-agentSkill
- auto-permissions-review-disableSkill
- auto-permissions-review-enableSkill
- auto-permissions-review-installSkill
- brand-research-agentSkill
- chart-generationSkill
- cmo-agentSkill
- competitive-intel-agentSkill
- copywriter-agentSkill
- debug-councilSkill
- device-framerSkill
- docxSkill
- expired-patent-scoutSkill
- feature-councilSkill
- icon-generationSkill
- image-generationSkill
- ios-to-androidSkill
- market-researcher-agentSkill
- media-utilsSkill
- mobile-parity-checkSkill
- model-councilSkill
- music-generationSkill
- parallel-builderSkill
- patent-lawyer-agentSkill
- patent-prosecution-agentSkill
- pdfSkill
- pitch-deck-agentSkill
- podcast-producer-agentSkill
- pptxSkill
- product-engineer-agentSkill
- react-to-iosSkill
- review-analyst-agentSkill
- search-trend-product-scoutSkill
- sidequestSkill
- slide-generationSkill
- social-producer-agentSkill
- style-guideSkill
- video-generationSkill
- video-producer-agentSkill
- voice-generationSkill
- walkthrough-script-agentSkill
- xlsxSkill
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

