Vibecode remove.bg
track this build5 phases, 10 steps, beginner friendly0%The open-source model behind this task (rembg with its ONNX models) runs on a laptop CPU in a couple of seconds per image. A drag-and-drop page around it is a sitting. What you lose is edge quality on hair and glass, batch scale and the Photoshop plugin.
You are building a lean indie version of remove.bg. Create the following project files first, then implement the application by following them. Keep the files updated as decisions change. Do not collapse this into a single README or prompt. ===== README.md ===== # remove.bg · indie build Background removal on your own machine: rembg behind a CLI and a localhost page with drag-and-drop, batch processing, background replacement and export at full resolution. Nothing is uploaded anywhere. Estimated effort: **one sitting**. Work `BUILD_PLAN.md` top to bottom · every phase ends in a check that has to pass before the next one starts. ## Stack | Part | Choice | Why | | --- | --- | --- | | Engine | rembg with onnxruntime | open models that run on a laptop CPU | | Runtime | Python 3.11+, a stdlib or FastAPI server on localhost | rembg is Python | | UI | Vanilla HTML and JS | one page | ## Before you start Have every one of these ready. The plan assumes them from step one. - [ ] **A terminal and a code editor** · free - Why: Every step below is a command you type or a file you edit. - Get it: VS Code (code.visualstudio.com), Cursor or Zed. Open a folder for the project and use the editor's built-in terminal. - Verify: You can open a folder and run a command in its terminal - [ ] **Git** · free - Why: History for your code, and the way most hosts deploy. - Get it: Install from git-scm.com or with your package manager, then run git init in the project folder once it exists. - Verify: git --version prints a version - [ ] **Python 3.11 or newer with pip** · free - Why: rembg is a Python package. - Get it: python.org or your package manager; use a virtual environment. - Verify: python3 --version prints 3.11 or higher - [ ] **rembg and its models** · free, a few GB of disk - Why: The whole engine. Models download on first use (hundreds of MB). - Get it: python3 -m venv .venv && source .venv/bin/activate && pip install 'rembg[cli]' onnxruntime - Verify: rembg --help prints usage - [ ] **Test images: a portrait, a product on white, something with hair** · free - Why: Each phase is judged on real results. - Get it: Three photos. ## Quick start ```sh python3 -m venv .venv && source .venv/bin/activate pip install 'rembg[cli]' onnxruntime pillow ``` Then copy `.env.example` to `.env` and fill in the values it documents. ## Honest limits This build deliberately does not replace: - Their edge quality on hair and glass. - Plugins, API scale, GPU batch processing. - edge quality on hair, fur and glass - the Photoshop and Figma plugins - the API at scale - GPU speed for batches If one of those is essential to you, that is the reason to keep paying for remove.bg, and the README should say so rather than pretend. ===== BRIEF.md ===== # Build brief · remove.bg The one-shot brief this plan expands. `BUILD_PLAN.md` (or `MILESTONES.md`) is the same sequence broken into steps and checks; where the two disagree, the plan wins. Build me a background remover like remove.bg that runs on my machine. Build it in phases, in the order below. Do not write the whole thing in one pass. Finish a phase, run its "Done when" check, fix what fails, and only then start the next phase. ### Stack (fixed, do not substitute) - Python 3.11+, rembg with onnxruntime, a small stdlib or FastAPI server bound to localhost. Vanilla HTML and JS for the page. No uploads leave the machine. ### Phase 1 · The CLI Build: cut in.jpg out.png removes the background with the default model, plus a --model flag (u2net, isnet-general-use, birefnet) and --alpha-matting for hair. Done when: a portrait produces a clean transparent PNG, a product on white produces a clean cutout, and switching models changes the result. Do not build yet: the server. ### Phase 2 · Batch Build: cut --dir in/ out/ processes a folder with a progress line, skips already-done files by hash, and never overwrites. Done when: 50 images process with a running count and a rerun does nothing. ### Phase 3 · The page Build: a localhost page with drag-and-drop, paste and a file picker, a before/after slider, and download as PNG. The file is posted to the local server and never anywhere else. Done when: a dropped image returns a transparent result in under 5 seconds on CPU and the network tab shows only localhost. ### Phase 4 · Backgrounds and export Build: replace the background with a color, a gradient or another image; export at original resolution or a chosen size; copy to clipboard. Done when: a product shot on a chosen color exports at full resolution. ### Phase 5 · Package Build: a one-line install (pip or a pinned requirements file), a model download step with sizes stated, and the README. Done when: a fresh machine goes from clone to first cutout using only the README. ### Out of scope (and why) - Their edge quality on hair and glass. The open models are good, theirs are better, and that gap is the product. - Plugins, API scale, GPU batch processing. ### README must contain - Model sizes and which to use for which subject. - One line: nothing is uploaded. ===== AGENTS.md ===== # Agent instructions · remove.bg indie build - Read `README.md` and `BUILD_PLAN.md` before writing code. The stack is fixed: rembg with onnxruntime, Python 3.11+, a stdlib or FastAPI server on localhost, Vanilla HTML and JS. Do not substitute. - Work one phase at a time, in order. Do not start a phase until every "Done when" item of the previous one passes. - Prefer the fewest moving parts that satisfy the step. No frameworks, services or dependencies the plan does not name. - Secrets live in `.env`, never in source or logs. Keep `.env.example` current when a variable is introduced. - Do not invent cryptography, security guarantees, APIs or compliance claims. - Add a focused test for every destructive, security-sensitive or data-loss path the plan names. - Run the project checks before declaring a phase complete, and record any deliberate shortcut in the README under "Tradeoffs". ===== BUILD_PLAN.md ===== # Build plan · remove.bg Background removal on your own machine: rembg behind a CLI and a localhost page with drag-and-drop, batch processing, background replacement and export at full resolution. Nothing is uploaded anywhere. Phases are in dependency order. Each ends in a "Done when" list; treat an unticked item as a blocker, not a note. ## Phase 1 · The CLI cut in.jpg out.png with model and alpha-matting flags. ### Steps 1. Create the venv and a cut script wrapping rembg ```sh python3 -m venv .venv && source .venv/bin/activate pip install 'rembg[cli]' onnxruntime pillow ``` 2. Add --model and --alpha-matting flags ### Done when - [ ] A portrait produces a clean transparent PNG - [ ] Switching models changes the result ## Phase 2 · Batch A folder in, a folder out, resumable. ### Steps 1. cut --dir in/ out/ with a progress line 2. Skip already-done files by hash; never overwrite ### Done when - [ ] 50 images process with a count - [ ] A rerun does nothing ## Phase 3 · The page Drop, paste, pick; before/after; only localhost in the network tab. ### Steps 1. A localhost server with POST /cut returning PNG 2. The page with three inputs and a before/after slider ### Done when - [ ] A dropped image returns in under 5 seconds on CPU - [ ] The network tab shows only localhost ## Phase 4 · Backgrounds and export Replace with color, gradient or image; export at full size; copy. ### Steps 1. Compositing options on the canvas 2. Export at original or chosen size; copy to clipboard ### Done when - [ ] A product on a chosen color exports at full resolution ## Phase 5 · Package One-line install and model sizes stated. ### Steps 1. Pinned requirements.txt and a Makefile or run script 2. README with model sizes and the nothing-is-uploaded line Files: `README.md` ### Done when - [ ] A fresh machine reaches a first cutout from the README ## Not in this build - Their edge quality on hair and glass. - Plugins, API scale, GPU batch processing. ## After v1, if you want it - A Photoshop-style refine-edge brush - A watch-folder mode ===== .env.example ===== # Copy to .env and fill in. Never commit .env; this file documents it. # Required. Localhost port for the page. PORT=8000 # Optional. Default model; birefnet for hair, u2net for speed. REMBG_MODEL=isnet-general-use # Optional. Where rembg stores downloaded models. MODEL_DIR=~/.u2net
You are building a lean indie version of remove.bg. Create the following project files first, then implement the application by following them. Keep the files updated as decisions change. Do not collapse this into a single README or prompt. ===== README.md ===== # remove.bg · indie build Background removal on your own machine: rembg behind a CLI and a localhost page with drag-and-drop, batch processing, background replacement and export at full resolution. Nothing is uploaded anywhere. Estimated effort: **one sitting**. Work `BUILD_PLAN.md` top to bottom · every phase ends in a check that has to pass before the next one starts. ## Stack | Part | Choice | Why | | --- | --- | --- | | Engine | rembg with onnxruntime | open models that run on a laptop CPU | | Runtime | Python 3.11+, a stdlib or FastAPI server on localhost | rembg is Python | | UI | Vanilla HTML and JS | one page | ## Before you start Have every one of these ready. The plan assumes them from step one. - [ ] **A terminal and a code editor** · free - Why: Every step below is a command you type or a file you edit. - Get it: VS Code (code.visualstudio.com), Cursor or Zed. Open a folder for the project and use the editor's built-in terminal. - Verify: You can open a folder and run a command in its terminal - [ ] **Git** · free - Why: History for your code, and the way most hosts deploy. - Get it: Install from git-scm.com or with your package manager, then run git init in the project folder once it exists. - Verify: git --version prints a version - [ ] **Python 3.11 or newer with pip** · free - Why: rembg is a Python package. - Get it: python.org or your package manager; use a virtual environment. - Verify: python3 --version prints 3.11 or higher - [ ] **rembg and its models** · free, a few GB of disk - Why: The whole engine. Models download on first use (hundreds of MB). - Get it: python3 -m venv .venv && source .venv/bin/activate && pip install 'rembg[cli]' onnxruntime - Verify: rembg --help prints usage - [ ] **Test images: a portrait, a product on white, something with hair** · free - Why: Each phase is judged on real results. - Get it: Three photos. ## Quick start ```sh python3 -m venv .venv && source .venv/bin/activate pip install 'rembg[cli]' onnxruntime pillow ``` Then copy `.env.example` to `.env` and fill in the values it documents. ## Honest limits This build deliberately does not replace: - Their edge quality on hair and glass. - Plugins, API scale, GPU batch processing. - edge quality on hair, fur and glass - the Photoshop and Figma plugins - the API at scale - GPU speed for batches If one of those is essential to you, that is the reason to keep paying for remove.bg, and the README should say so rather than pretend. ===== BRIEF.md ===== # Build brief · remove.bg The one-shot brief this plan expands. `BUILD_PLAN.md` (or `MILESTONES.md`) is the same sequence broken into steps and checks; where the two disagree, the plan wins. Build me a background remover like remove.bg that runs on my machine. Build it in phases, in the order below. Do not write the whole thing in one pass. Finish a phase, run its "Done when" check, fix what fails, and only then start the next phase. ### Stack (fixed, do not substitute) - Python 3.11+, rembg with onnxruntime, a small stdlib or FastAPI server bound to localhost. Vanilla HTML and JS for the page. No uploads leave the machine. ### Phase 1 · The CLI Build: cut in.jpg out.png removes the background with the default model, plus a --model flag (u2net, isnet-general-use, birefnet) and --alpha-matting for hair. Done when: a portrait produces a clean transparent PNG, a product on white produces a clean cutout, and switching models changes the result. Do not build yet: the server. ### Phase 2 · Batch Build: cut --dir in/ out/ processes a folder with a progress line, skips already-done files by hash, and never overwrites. Done when: 50 images process with a running count and a rerun does nothing. ### Phase 3 · The page Build: a localhost page with drag-and-drop, paste and a file picker, a before/after slider, and download as PNG. The file is posted to the local server and never anywhere else. Done when: a dropped image returns a transparent result in under 5 seconds on CPU and the network tab shows only localhost. ### Phase 4 · Backgrounds and export Build: replace the background with a color, a gradient or another image; export at original resolution or a chosen size; copy to clipboard. Done when: a product shot on a chosen color exports at full resolution. ### Phase 5 · Package Build: a one-line install (pip or a pinned requirements file), a model download step with sizes stated, and the README. Done when: a fresh machine goes from clone to first cutout using only the README. ### Out of scope (and why) - Their edge quality on hair and glass. The open models are good, theirs are better, and that gap is the product. - Plugins, API scale, GPU batch processing. ### README must contain - Model sizes and which to use for which subject. - One line: nothing is uploaded. ===== AGENTS.md ===== # Agent instructions · remove.bg indie build - Read `README.md` and `BUILD_PLAN.md` before writing code. The stack is fixed: rembg with onnxruntime, Python 3.11+, a stdlib or FastAPI server on localhost, Vanilla HTML and JS. Do not substitute. - Work one phase at a time, in order. Do not start a phase until every "Done when" item of the previous one passes. - Prefer the fewest moving parts that satisfy the step. No frameworks, services or dependencies the plan does not name. - Secrets live in `.env`, never in source or logs. Keep `.env.example` current when a variable is introduced. - Do not invent cryptography, security guarantees, APIs or compliance claims. - Add a focused test for every destructive, security-sensitive or data-loss path the plan names. - Run the project checks before declaring a phase complete, and record any deliberate shortcut in the README under "Tradeoffs". ===== BUILD_PLAN.md ===== # Build plan · remove.bg Background removal on your own machine: rembg behind a CLI and a localhost page with drag-and-drop, batch processing, background replacement and export at full resolution. Nothing is uploaded anywhere. Phases are in dependency order. Each ends in a "Done when" list; treat an unticked item as a blocker, not a note. ## Phase 1 · The CLI cut in.jpg out.png with model and alpha-matting flags. ### Steps 1. Create the venv and a cut script wrapping rembg ```sh python3 -m venv .venv && source .venv/bin/activate pip install 'rembg[cli]' onnxruntime pillow ``` 2. Add --model and --alpha-matting flags ### Done when - [ ] A portrait produces a clean transparent PNG - [ ] Switching models changes the result ## Phase 2 · Batch A folder in, a folder out, resumable. ### Steps 1. cut --dir in/ out/ with a progress line 2. Skip already-done files by hash; never overwrite ### Done when - [ ] 50 images process with a count - [ ] A rerun does nothing ## Phase 3 · The page Drop, paste, pick; before/after; only localhost in the network tab. ### Steps 1. A localhost server with POST /cut returning PNG 2. The page with three inputs and a before/after slider ### Done when - [ ] A dropped image returns in under 5 seconds on CPU - [ ] The network tab shows only localhost ## Phase 4 · Backgrounds and export Replace with color, gradient or image; export at full size; copy. ### Steps 1. Compositing options on the canvas 2. Export at original or chosen size; copy to clipboard ### Done when - [ ] A product on a chosen color exports at full resolution ## Phase 5 · Package One-line install and model sizes stated. ### Steps 1. Pinned requirements.txt and a Makefile or run script 2. README with model sizes and the nothing-is-uploaded line Files: `README.md` ### Done when - [ ] A fresh machine reaches a first cutout from the README ## Not in this build - Their edge quality on hair and glass. - Plugins, API scale, GPU batch processing. ## After v1, if you want it - A Photoshop-style refine-edge brush - A watch-folder mode ===== .env.example ===== # Copy to .env and fill in. Never commit .env; this file documents it. # Required. Localhost port for the page. PORT=8000 # Optional. Default model; birefnet for hair, u2net for speed. REMBG_MODEL=isnet-general-use # Optional. Where rembg stores downloaded models. MODEL_DIR=~/.u2net
You are building a production product version of remove.bg. Create the following project files first, then implement the application by following them. Keep the files updated as decisions change. Do not collapse this into a single README or prompt. ===== PRODUCT.md ===== # remove.bg · product brief ## Problem The open-source model behind this task (rembg with its ONNX models) runs on a laptop CPU in a couple of seconds per image. A drag-and-drop page around it is a sitting. What you lose is edge quality on hair and glass, batch scale and the Photoshop plugin. ## Product outcome Background removal for a small team that never leaves the building. ## Target user A builder who needs a maintainable product foundation, not a one-off demo. ## Required capabilities - Python 3.11+ with rembg and onnxruntime - a few GB of disk for models ## Explicit non-goals for v1 - Their edge quality on hair and glass. - Plugins, API scale, GPU batch processing. - edge quality on hair, fur and glass - the Photoshop and Figma plugins - the API at scale - GPU speed for batches ## Success criteria - Network tab verified localhost-only - Batch resumability verified ===== BRIEF.md ===== # Build brief · remove.bg The one-shot brief this plan expands. `BUILD_PLAN.md` (or `MILESTONES.md`) is the same sequence broken into steps and checks; where the two disagree, the plan wins. Build me a background remover like remove.bg that runs on my machine. Build it in phases, in the order below. Do not write the whole thing in one pass. Finish a phase, run its "Done when" check, fix what fails, and only then start the next phase. ### Stack (fixed, do not substitute) - Python 3.11+, rembg with onnxruntime, a small stdlib or FastAPI server bound to localhost. Vanilla HTML and JS for the page. No uploads leave the machine. ### Phase 1 · The CLI Build: cut in.jpg out.png removes the background with the default model, plus a --model flag (u2net, isnet-general-use, birefnet) and --alpha-matting for hair. Done when: a portrait produces a clean transparent PNG, a product on white produces a clean cutout, and switching models changes the result. Do not build yet: the server. ### Phase 2 · Batch Build: cut --dir in/ out/ processes a folder with a progress line, skips already-done files by hash, and never overwrites. Done when: 50 images process with a running count and a rerun does nothing. ### Phase 3 · The page Build: a localhost page with drag-and-drop, paste and a file picker, a before/after slider, and download as PNG. The file is posted to the local server and never anywhere else. Done when: a dropped image returns a transparent result in under 5 seconds on CPU and the network tab shows only localhost. ### Phase 4 · Backgrounds and export Build: replace the background with a color, a gradient or another image; export at original resolution or a chosen size; copy to clipboard. Done when: a product shot on a chosen color exports at full resolution. ### Phase 5 · Package Build: a one-line install (pip or a pinned requirements file), a model download step with sizes stated, and the README. Done when: a fresh machine goes from clone to first cutout using only the README. ### Out of scope (and why) - Their edge quality on hair and glass. The open models are good, theirs are better, and that gap is the product. - Plugins, API scale, GPU batch processing. ### README must contain - Model sizes and which to use for which subject. - One line: nothing is uploaded. ===== ARCHITECTURE.md ===== # Architecture · remove.bg ## Stack | Part | Choice | Why | | --- | --- | --- | | Engine | rembg with onnxruntime | open models that run on a laptop CPU | | Runtime | Python 3.11+, a stdlib or FastAPI server on localhost | rembg is Python | | UI | Vanilla HTML and JS | one page | ## Modules Each module has one owner concern and a documented way to replace it. | Module | Owns | How to replace it | | --- | --- | --- | | Engine | rembg calls and models | A different model behind the same function | | Server | /cut | Any HTTP layer | | UI | the page | Any client | ## Configuration Every runtime setting is an environment variable documented in `.env.example`, validated at startup, with a safe local default wherever one exists. - `PORT` · required · Localhost port for the page. - `REMBG_MODEL` · optional · Default model; birefnet for hair, u2net for speed. - `MODEL_DIR` · optional · Where rembg stores downloaded models. ## Production baseline - Security: least privilege, input validation at every boundary, secret redaction in logs, rate limits on abuse-prone paths, no invented security primitives. - Data: explicit schema and migrations, transactional writes where integrity matters, backup and restore procedures that have been exercised. - Integrations: adapters around third-party providers, idempotent webhook or job processing, bounded retries, timeouts. - Observability: structured logs with request or operation ids, an error-tracking hook, and health and readiness checks where a server exists. - Quality: unit tests for domain rules, integration tests at module boundaries, one end-to-end test of the critical path. ## Decision records For each dependency in the stack table, keep a short note: why it was chosen, its failure mode, and how it is replaced. Do not add infrastructure until a requirement in `PRODUCT.md` justifies it. ===== AGENTS.md ===== # Agent instructions · remove.bg product build - Read `PRODUCT.md` and `ARCHITECTURE.md` before changing code. The stack is fixed: rembg with onnxruntime, Python 3.11+, a stdlib or FastAPI server on localhost, Vanilla HTML and JS. - Implement milestone by milestone from `MILESTONES.md`; keep each change reviewable and leave the application runnable at every commit. - Treat authentication, payments, encryption, imports, webhooks and destructive actions as high-risk boundaries when present. - Never invent cryptography or silently weaken a requirement to make a check pass. - Put every external service behind an interface with a deterministic fake for tests. - Add migrations and rollback or recovery notes for every persistent data change. - Log useful operational context without credentials, tokens, passwords or personal data. - Update documentation and run every check before completing a milestone. ===== MILESTONES.md ===== # Delivery milestones · remove.bg Estimated effort: **one sitting** for the indie phases; the production-only milestones add the trust and operability layer. ## M1 · The CLI cut in.jpg out.png with model and alpha-matting flags. ### Steps 1. Create the venv and a cut script wrapping rembg ```sh python3 -m venv .venv && source .venv/bin/activate pip install 'rembg[cli]' onnxruntime pillow ``` 2. Add --model and --alpha-matting flags ### Done when - [ ] A portrait produces a clean transparent PNG - [ ] Switching models changes the result ## M2 · Batch A folder in, a folder out, resumable. ### Steps 1. cut --dir in/ out/ with a progress line 2. Skip already-done files by hash; never overwrite ### Done when - [ ] 50 images process with a count - [ ] A rerun does nothing ## M3 · The page Drop, paste, pick; before/after; only localhost in the network tab. ### Steps 1. A localhost server with POST /cut returning PNG 2. The page with three inputs and a before/after slider ### Done when - [ ] A dropped image returns in under 5 seconds on CPU - [ ] The network tab shows only localhost ## M4 · Backgrounds and export Replace with color, gradient or image; export at full size; copy. ### Steps 1. Compositing options on the canvas 2. Export at original or chosen size; copy to clipboard ### Done when - [ ] A product on a chosen color exports at full resolution ## M5 · Package One-line install and model sizes stated. ### Steps 1. Pinned requirements.txt and a Makefile or run script 2. README with model sizes and the nothing-is-uploaded line Files: `README.md` ### Done when - [ ] A fresh machine reaches a first cutout from the README ## M6 · Run it for a team (production only) A shared instance on your network with a GPU if you have one. ### Steps 1. Bind to the LAN behind basic auth; onnxruntime-gpu where available 2. A job queue so ten uploads do not run at once ### Done when - [ ] Two people use it concurrently without a crash ===== OPERATIONS.md ===== # Operations · remove.bg ## Backup Nothing to back up; models re-download. ## Restore Reinstall. Do a restore drill before the first real user, and write the date here when it passes. ## Monitoring Queue depth. ## Incident checklist None of consequence; no data is stored. 1. Contain the issue without destroying evidence or user data. 2. Record the timeline and affected scope. 3. Rotate exposed secrets and revoke compromised sessions or credentials. 4. Restore from a verified backup when needed. 5. Document the root cause, the remediation and the regression test. ## Release gate - [ ] Network tab verified localhost-only - [ ] Batch resumability verified ## Launch constraint Do not market omitted remove.bg capabilities as implemented. The non-goals in `PRODUCT.md` remain user-visible limitations until they are deliberately delivered. ===== .env.example ===== # Copy to .env and fill in. Never commit .env; this file documents it. # Required. Localhost port for the page. PORT=8000 # Optional. Default model; birefnet for hair, u2net for speed. REMBG_MODEL=isnet-general-use # Optional. Where rembg stores downloaded models. MODEL_DIR=~/.u2net
# remove.bg · indie build Background removal on your own machine: rembg behind a CLI and a localhost page with drag-and-drop, batch processing, background replacement and export at full resolution. Nothing is uploaded anywhere. Estimated effort: **one sitting**. Work `BUILD_PLAN.md` top to bottom · every phase ends in a check that has to pass before the next one starts. ## Stack | Part | Choice | Why | | --- | --- | --- | | Engine | rembg with onnxruntime | open models that run on a laptop CPU | | Runtime | Python 3.11+, a stdlib or FastAPI server on localhost | rembg is Python | | UI | Vanilla HTML and JS | one page | ## Before you start Have every one of these ready. The plan assumes them from step one. - [ ] **A terminal and a code editor** · free - Why: Every step below is a command you type or a file you edit. - Get it: VS Code (code.visualstudio.com), Cursor or Zed. Open a folder for the project and use the editor's built-in terminal. - Verify: You can open a folder and run a command in its terminal - [ ] **Git** · free - Why: History for your code, and the way most hosts deploy. - Get it: Install from git-scm.com or with your package manager, then run git init in the project folder once it exists. - Verify: git --version prints a version - [ ] **Python 3.11 or newer with pip** · free - Why: rembg is a Python package. - Get it: python.org or your package manager; use a virtual environment. - Verify: python3 --version prints 3.11 or higher - [ ] **rembg and its models** · free, a few GB of disk - Why: The whole engine. Models download on first use (hundreds of MB). - Get it: python3 -m venv .venv && source .venv/bin/activate && pip install 'rembg[cli]' onnxruntime - Verify: rembg --help prints usage - [ ] **Test images: a portrait, a product on white, something with hair** · free - Why: Each phase is judged on real results. - Get it: Three photos. ## Quick start ```sh python3 -m venv .venv && source .venv/bin/activate pip install 'rembg[cli]' onnxruntime pillow ``` Then copy `.env.example` to `.env` and fill in the values it documents. ## Honest limits This build deliberately does not replace: - Their edge quality on hair and glass. - Plugins, API scale, GPU batch processing. - edge quality on hair, fur and glass - the Photoshop and Figma plugins - the API at scale - GPU speed for batches If one of those is essential to you, that is the reason to keep paying for remove.bg, and the README should say so rather than pretend.
# Build brief · remove.bg The one-shot brief this plan expands. `BUILD_PLAN.md` (or `MILESTONES.md`) is the same sequence broken into steps and checks; where the two disagree, the plan wins. Build me a background remover like remove.bg that runs on my machine. Build it in phases, in the order below. Do not write the whole thing in one pass. Finish a phase, run its "Done when" check, fix what fails, and only then start the next phase. ### Stack (fixed, do not substitute) - Python 3.11+, rembg with onnxruntime, a small stdlib or FastAPI server bound to localhost. Vanilla HTML and JS for the page. No uploads leave the machine. ### Phase 1 · The CLI Build: cut in.jpg out.png removes the background with the default model, plus a --model flag (u2net, isnet-general-use, birefnet) and --alpha-matting for hair. Done when: a portrait produces a clean transparent PNG, a product on white produces a clean cutout, and switching models changes the result. Do not build yet: the server. ### Phase 2 · Batch Build: cut --dir in/ out/ processes a folder with a progress line, skips already-done files by hash, and never overwrites. Done when: 50 images process with a running count and a rerun does nothing. ### Phase 3 · The page Build: a localhost page with drag-and-drop, paste and a file picker, a before/after slider, and download as PNG. The file is posted to the local server and never anywhere else. Done when: a dropped image returns a transparent result in under 5 seconds on CPU and the network tab shows only localhost. ### Phase 4 · Backgrounds and export Build: replace the background with a color, a gradient or another image; export at original resolution or a chosen size; copy to clipboard. Done when: a product shot on a chosen color exports at full resolution. ### Phase 5 · Package Build: a one-line install (pip or a pinned requirements file), a model download step with sizes stated, and the README. Done when: a fresh machine goes from clone to first cutout using only the README. ### Out of scope (and why) - Their edge quality on hair and glass. The open models are good, theirs are better, and that gap is the product. - Plugins, API scale, GPU batch processing. ### README must contain - Model sizes and which to use for which subject. - One line: nothing is uploaded.
# Agent instructions · remove.bg indie build - Read `README.md` and `BUILD_PLAN.md` before writing code. The stack is fixed: rembg with onnxruntime, Python 3.11+, a stdlib or FastAPI server on localhost, Vanilla HTML and JS. Do not substitute. - Work one phase at a time, in order. Do not start a phase until every "Done when" item of the previous one passes. - Prefer the fewest moving parts that satisfy the step. No frameworks, services or dependencies the plan does not name. - Secrets live in `.env`, never in source or logs. Keep `.env.example` current when a variable is introduced. - Do not invent cryptography, security guarantees, APIs or compliance claims. - Add a focused test for every destructive, security-sensitive or data-loss path the plan names. - Run the project checks before declaring a phase complete, and record any deliberate shortcut in the README under "Tradeoffs".
# Build plan · remove.bg Background removal on your own machine: rembg behind a CLI and a localhost page with drag-and-drop, batch processing, background replacement and export at full resolution. Nothing is uploaded anywhere. Phases are in dependency order. Each ends in a "Done when" list; treat an unticked item as a blocker, not a note. ## Phase 1 · The CLI cut in.jpg out.png with model and alpha-matting flags. ### Steps 1. Create the venv and a cut script wrapping rembg ```sh python3 -m venv .venv && source .venv/bin/activate pip install 'rembg[cli]' onnxruntime pillow ``` 2. Add --model and --alpha-matting flags ### Done when - [ ] A portrait produces a clean transparent PNG - [ ] Switching models changes the result ## Phase 2 · Batch A folder in, a folder out, resumable. ### Steps 1. cut --dir in/ out/ with a progress line 2. Skip already-done files by hash; never overwrite ### Done when - [ ] 50 images process with a count - [ ] A rerun does nothing ## Phase 3 · The page Drop, paste, pick; before/after; only localhost in the network tab. ### Steps 1. A localhost server with POST /cut returning PNG 2. The page with three inputs and a before/after slider ### Done when - [ ] A dropped image returns in under 5 seconds on CPU - [ ] The network tab shows only localhost ## Phase 4 · Backgrounds and export Replace with color, gradient or image; export at full size; copy. ### Steps 1. Compositing options on the canvas 2. Export at original or chosen size; copy to clipboard ### Done when - [ ] A product on a chosen color exports at full resolution ## Phase 5 · Package One-line install and model sizes stated. ### Steps 1. Pinned requirements.txt and a Makefile or run script 2. README with model sizes and the nothing-is-uploaded line Files: `README.md` ### Done when - [ ] A fresh machine reaches a first cutout from the README ## Not in this build - Their edge quality on hair and glass. - Plugins, API scale, GPU batch processing. ## After v1, if you want it - A Photoshop-style refine-edge brush - A watch-folder mode
# Copy to .env and fill in. Never commit .env; this file documents it. # Required. Localhost port for the page. PORT=8000 # Optional. Default model; birefnet for hair, u2net for speed. REMBG_MODEL=isnet-general-use # Optional. Where rembg stores downloaded models. MODEL_DIR=~/.u2net
# remove.bg · product brief ## Problem The open-source model behind this task (rembg with its ONNX models) runs on a laptop CPU in a couple of seconds per image. A drag-and-drop page around it is a sitting. What you lose is edge quality on hair and glass, batch scale and the Photoshop plugin. ## Product outcome Background removal for a small team that never leaves the building. ## Target user A builder who needs a maintainable product foundation, not a one-off demo. ## Required capabilities - Python 3.11+ with rembg and onnxruntime - a few GB of disk for models ## Explicit non-goals for v1 - Their edge quality on hair and glass. - Plugins, API scale, GPU batch processing. - edge quality on hair, fur and glass - the Photoshop and Figma plugins - the API at scale - GPU speed for batches ## Success criteria - Network tab verified localhost-only - Batch resumability verified
# Build brief · remove.bg The one-shot brief this plan expands. `BUILD_PLAN.md` (or `MILESTONES.md`) is the same sequence broken into steps and checks; where the two disagree, the plan wins. Build me a background remover like remove.bg that runs on my machine. Build it in phases, in the order below. Do not write the whole thing in one pass. Finish a phase, run its "Done when" check, fix what fails, and only then start the next phase. ### Stack (fixed, do not substitute) - Python 3.11+, rembg with onnxruntime, a small stdlib or FastAPI server bound to localhost. Vanilla HTML and JS for the page. No uploads leave the machine. ### Phase 1 · The CLI Build: cut in.jpg out.png removes the background with the default model, plus a --model flag (u2net, isnet-general-use, birefnet) and --alpha-matting for hair. Done when: a portrait produces a clean transparent PNG, a product on white produces a clean cutout, and switching models changes the result. Do not build yet: the server. ### Phase 2 · Batch Build: cut --dir in/ out/ processes a folder with a progress line, skips already-done files by hash, and never overwrites. Done when: 50 images process with a running count and a rerun does nothing. ### Phase 3 · The page Build: a localhost page with drag-and-drop, paste and a file picker, a before/after slider, and download as PNG. The file is posted to the local server and never anywhere else. Done when: a dropped image returns a transparent result in under 5 seconds on CPU and the network tab shows only localhost. ### Phase 4 · Backgrounds and export Build: replace the background with a color, a gradient or another image; export at original resolution or a chosen size; copy to clipboard. Done when: a product shot on a chosen color exports at full resolution. ### Phase 5 · Package Build: a one-line install (pip or a pinned requirements file), a model download step with sizes stated, and the README. Done when: a fresh machine goes from clone to first cutout using only the README. ### Out of scope (and why) - Their edge quality on hair and glass. The open models are good, theirs are better, and that gap is the product. - Plugins, API scale, GPU batch processing. ### README must contain - Model sizes and which to use for which subject. - One line: nothing is uploaded.
# Architecture · remove.bg ## Stack | Part | Choice | Why | | --- | --- | --- | | Engine | rembg with onnxruntime | open models that run on a laptop CPU | | Runtime | Python 3.11+, a stdlib or FastAPI server on localhost | rembg is Python | | UI | Vanilla HTML and JS | one page | ## Modules Each module has one owner concern and a documented way to replace it. | Module | Owns | How to replace it | | --- | --- | --- | | Engine | rembg calls and models | A different model behind the same function | | Server | /cut | Any HTTP layer | | UI | the page | Any client | ## Configuration Every runtime setting is an environment variable documented in `.env.example`, validated at startup, with a safe local default wherever one exists. - `PORT` · required · Localhost port for the page. - `REMBG_MODEL` · optional · Default model; birefnet for hair, u2net for speed. - `MODEL_DIR` · optional · Where rembg stores downloaded models. ## Production baseline - Security: least privilege, input validation at every boundary, secret redaction in logs, rate limits on abuse-prone paths, no invented security primitives. - Data: explicit schema and migrations, transactional writes where integrity matters, backup and restore procedures that have been exercised. - Integrations: adapters around third-party providers, idempotent webhook or job processing, bounded retries, timeouts. - Observability: structured logs with request or operation ids, an error-tracking hook, and health and readiness checks where a server exists. - Quality: unit tests for domain rules, integration tests at module boundaries, one end-to-end test of the critical path. ## Decision records For each dependency in the stack table, keep a short note: why it was chosen, its failure mode, and how it is replaced. Do not add infrastructure until a requirement in `PRODUCT.md` justifies it.
# Agent instructions · remove.bg product build - Read `PRODUCT.md` and `ARCHITECTURE.md` before changing code. The stack is fixed: rembg with onnxruntime, Python 3.11+, a stdlib or FastAPI server on localhost, Vanilla HTML and JS. - Implement milestone by milestone from `MILESTONES.md`; keep each change reviewable and leave the application runnable at every commit. - Treat authentication, payments, encryption, imports, webhooks and destructive actions as high-risk boundaries when present. - Never invent cryptography or silently weaken a requirement to make a check pass. - Put every external service behind an interface with a deterministic fake for tests. - Add migrations and rollback or recovery notes for every persistent data change. - Log useful operational context without credentials, tokens, passwords or personal data. - Update documentation and run every check before completing a milestone.
# Delivery milestones · remove.bg Estimated effort: **one sitting** for the indie phases; the production-only milestones add the trust and operability layer. ## M1 · The CLI cut in.jpg out.png with model and alpha-matting flags. ### Steps 1. Create the venv and a cut script wrapping rembg ```sh python3 -m venv .venv && source .venv/bin/activate pip install 'rembg[cli]' onnxruntime pillow ``` 2. Add --model and --alpha-matting flags ### Done when - [ ] A portrait produces a clean transparent PNG - [ ] Switching models changes the result ## M2 · Batch A folder in, a folder out, resumable. ### Steps 1. cut --dir in/ out/ with a progress line 2. Skip already-done files by hash; never overwrite ### Done when - [ ] 50 images process with a count - [ ] A rerun does nothing ## M3 · The page Drop, paste, pick; before/after; only localhost in the network tab. ### Steps 1. A localhost server with POST /cut returning PNG 2. The page with three inputs and a before/after slider ### Done when - [ ] A dropped image returns in under 5 seconds on CPU - [ ] The network tab shows only localhost ## M4 · Backgrounds and export Replace with color, gradient or image; export at full size; copy. ### Steps 1. Compositing options on the canvas 2. Export at original or chosen size; copy to clipboard ### Done when - [ ] A product on a chosen color exports at full resolution ## M5 · Package One-line install and model sizes stated. ### Steps 1. Pinned requirements.txt and a Makefile or run script 2. README with model sizes and the nothing-is-uploaded line Files: `README.md` ### Done when - [ ] A fresh machine reaches a first cutout from the README ## M6 · Run it for a team (production only) A shared instance on your network with a GPU if you have one. ### Steps 1. Bind to the LAN behind basic auth; onnxruntime-gpu where available 2. A job queue so ten uploads do not run at once ### Done when - [ ] Two people use it concurrently without a crash
# Operations · remove.bg ## Backup Nothing to back up; models re-download. ## Restore Reinstall. Do a restore drill before the first real user, and write the date here when it passes. ## Monitoring Queue depth. ## Incident checklist None of consequence; no data is stored. 1. Contain the issue without destroying evidence or user data. 2. Record the timeline and affected scope. 3. Rotate exposed secrets and revoke compromised sessions or credentials. 4. Restore from a verified backup when needed. 5. Document the root cause, the remediation and the regression test. ## Release gate - [ ] Network tab verified localhost-only - [ ] Batch resumability verified ## Launch constraint Do not market omitted remove.bg capabilities as implemented. The non-goals in `PRODUCT.md` remain user-visible limitations until they are deliberately delivered.
# Copy to .env and fill in. Never commit .env; this file documents it. # Required. Localhost port for the page. PORT=8000 # Optional. Default model; birefnet for hair, u2net for speed. REMBG_MODEL=isnet-general-use # Optional. Where rembg stores downloaded models. MODEL_DIR=~/.u2net
$ choose a build depth, inspect the files, then open the complete pack in your agent
Their model is visibly better on difficult edges, and product photographers process hundreds a day where two seconds each on a laptop is not fine.
xedge quality on hair, fur and glass
xthe Photoshop and Figma plugins
xthe API at scale
xGPU speed for batches
remove.bg pricing
40 credits$9/mo · monthly subscription · $108/yr
free tierThe free tier removes backgrounds at preview resolution only; full-resolution downloads cost a credit.
verified 2026-09-04 · source ↗
Is remove.bg free?
The free tier removes backgrounds at preview resolution only; full-resolution downloads cost a credit. Paid is 40 credits at $9/mo (checked 2026-09-04).
Vibecode remove.bg
Yes. A competent AI coding agent (Claude Code, Codex, Cursor) can build a usable personal remove.bg replacement in one session with the prompt on this page. It runs on your own machine or server with no subscription.
How much does remove.bg cost?
remove.bg costs about $9/month (40 credits, checked 2026-09-04), which is $108 per year. That's what you save by replacing it with one prompt.
What do I lose by replacing remove.bg?
Honestly: edge quality on hair, fur and glass; the Photoshop and Figma plugins; the API at scale; GPU speed for batches. If any of those are load-bearing for you, keep paying.
Is there an open-source alternative to remove.bg?
Yes: rembg (open-source background removal with several models). Using prior art is also vibecoding; the prompt is for when you want it exactly your way.