image-remove-background
Skill202 starsChanged 14 days agoMITView on GitHub
Removes image backgrounds and exports transparent PNGs using rembg (U2Net / BiRefNet). Use when the user wants background removal, matting, cutout, background cutout, transparent sprites, alpha PNG export, or remove background from a game/UI asset.
- Installs packages
1 other project uses a version of this.
Adopted by
Most recently taken up by
- godot-fun/gaiword for word, first seen Nov 1, 2026
Other versions1 project uses a version of this.
Word for word · 1
- godot-fun/gai★ 202100% 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 repository37 other files it gives its agents.
- AGENTS.mdAGENTS.md
- .agents/skills/AGENTS.mdAGENTS.md
- ai-text-to-speechSkill
- audio-denoiseSkill
- audio-fadeSkill
- audio-loudness-normalizationSkill
- audio-sample-rate-standardizeSkill
- audio-splitSkill
- audio-to-oggSkill
- audio-to-textSkill
- audio-to-wavSkill
- audio-trimSkill
- audio-volume-adjustSkill
- file-naming-normalizationSkill
- git-commit-messageSkill
- image-inpaint-regionSkill
- image-region-remove-key-color-appSkill
- image-remove-white-backgroundSkill
- image-resizeSkill
- image-sprite-sheet-splitSkill
- image-to-pngSkill
- image-to-textSkill
- image-trimSkill
- storyboard-av-mixSkill
- storyboard-shot-to-htmlSkill
- storyboardSkill
- storyboard-ttsSkill
- video-4k-normalizationSkill
- video-compress-to-sizeSkill
- video-merge-gpuSkill
- video-mergeSkill
- video-publishSkill
- video-remove-audioSkill
- video-to-4kSkill
- video-to-60fpsSkill
- video-to-ogvSkill
- video-to-wavSkill
The file
We split this skill into the rules it gives an agent
6 rules. About 0 are common, 1 is distinctive, and 5 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
5
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 11
Remove image backgrounds with AI matting via rembg.
- Very specific: line 15
When this skill applies, read and follow dependency-manager — run scripts as documented, install missing tools into .dependency/.
- Very specific: line 17
Run remove_background.py through the rembg manifest entry (.dependency/rembg/.venv/).
- Very specific: line 18
Do not hand-write rembg i / rembg p — use the bundled script.
- Very specific: line 48
Use bin/python on Unix. Model weights download on first run (~hundreds of MB).
- Very specific: line 111
Use the bundled script, not hand-written rembg CLI commands.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 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
Image Remove Background (rembg)
Remove image backgrounds with AI matting via rembg. Output is RGBA PNG with transparent background — ready for Godot sprites and UI.
Rules
When this skill applies, read and follow dependency-manager — run scripts as documented, install missing tools into .dependency/.
- Run
remove_background.pythrough therembgmanifest entry (.dependency/rembg/.venv/). Never use hostpython,py,python3, or any interpreter outside.dependency/. - Do not hand-write
rembg i/rembg p— use the bundled script. - Single file only. Pass one image with
--image; directories are not supported. populated: falseforrembgis not a reason to skip. Install first, setpopulated: true, retry the same command.- Pass the input path as-is (chat attachment path,
Downloads/foo.png, project folder, etc.). Output goes to<image-dir>/image-remove-background/by default — no path rewriting. - Never overwrite source files. Output lands in
image-remove-background/or--output.
Setup (first run)
From project root:
.dependency/python/python -m venv .dependency/rembg/.venv
.dependency/rembg/.venv/Scripts/python.exe -m pip install "rembg[cpu]"GPU (CUDA) — faster processing:
.dependency/rembg/.venv/Scripts/python.exe -m pip install "rembg[gpu]"Register in .dependency/manifest.json:
"rembg": {
"populated": true,
"bin": ".dependency/rembg/.venv/Scripts/python.exe"
}Use bin/python on Unix. Model weights download on first run (~hundreds of MB).
Quick Start
Default: create an image-remove-background/ folder beside the input file and write the PNG there (never overwrites sources):
# image/sprites/hero.png → image/sprites/image-remove-background/hero.png
.dependency/rembg/.venv/Scripts/python.exe .ai/image-remove-background/remove_background.py --image image/sprites/hero.pngCustom output path:
.dependency/rembg/.venv/Scripts/python.exe .ai/image-remove-background/remove_background.py --image image/sprites/hero.png -o image/sprites/hero_cutoutModel selection
| Model | Use case |
u2net (default) | General objects, icons, props |
u2netp | Faster / lighter; smaller assets |
isnet-general-use | Higher quality general matting |
birefnet-general | Best general quality (slower) |
birefnet-portrait | Characters / portraits |
u2net_human_seg | Human figures only |
.dependency/rembg/.venv/Scripts/python.exe .ai/image-remove-background/remove_background.py --image image/character.png --model birefnet-portraitEdge quality (alpha matting)
For hair, fur, or soft edges, enable alpha matting:
.dependency/rembg/.venv/Scripts/python.exe .ai/image-remove-background/remove_background.py --image image/portrait.png --alpha-mattingDefaults
| Option | Default | Notes |
--image | Required | Single supported image file |
| Output | <image-dir>/image-remove-background/<name>.png | Use -o / --output for custom file or directory |
--model | u2net | See table above |
--alpha-matting | off | Enable for fine edge detail |
--crop | off | Trim transparent borders after matting |
Supported inputs: .png, .jpg, .jpeg, .webp, .gif, .bmp, .tif, .tiff, .avif, .ico.
Agent Workflow
- Paths — Pass whatever image path the user gives or the chat
<image_files>path directly. Output lands inimage-remove-background/next to that file by default. - One file per run — process one image, verify the result, then repeat for additional files if needed.
- Pick model —
u2netfor generic assets;birefnet-portraitfor characters;birefnet-generalwhen quality matters. - Soft edges — try
--alpha-mattingif halos or jagged hair/fur appear. - Already transparent — script still runs; rembg re-mats from visible RGB. Warn user if source already has alpha.
- Revert — delete output file or
git restoreif needed; sources are never modified.
Agent Notes
- Use the bundled script, not hand-written
rembgCLI commands. - Missing rembg venv → populate
.dependency/per dependency-manager, retry same command. - Do not copy, move, or replace the source with cutout output — tell the user where the output file is.
- Flat white/green/magenta AI backgrounds → prefer image-remove-white-background over rembg.
- Need trim borders after matting → image-trim.
Troubleshooting
| Issue | Fix |
rembg missing | Follow Setup; update manifest |
Directory passed to --image | Run once per file; this skill accepts image files only |
| Output already exists | Delete the existing output or choose a different -o path |
| Very slow | Install rembg[gpu]; try --model u2netp |
| Jagged edges | --alpha-matting |
| Wrong subject removed | Switch model; try birefnet-general |
| Leftover background color | Re-run with --alpha-matting; check source contrast |
| OOM on large images | Script auto-downscales inputs above 4096 px longest side |
CLI
Copy-paste commands: cli/image-remove-background.md
Related
- Flat white/green/magenta AI backgrounds: image-remove-white-background (prefer over rembg)
- rembg docs: https://github.com/danielgatis/rembg
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.

