{"id":34497373,"url":"https://github.com/withoutbg/withoutbg","last_synced_at":"2026-03-06T20:03:26.370Z","repository":{"id":310550310,"uuid":"1040315335","full_name":"withoutbg/withoutbg","owner":"withoutbg","description":"Image Background Removal Toolkit - Open Source and API Models","archived":false,"fork":false,"pushed_at":"2026-03-02T21:23:58.000Z","size":9068,"stargazers_count":896,"open_issues_count":5,"forks_count":41,"subscribers_count":7,"default_branch":"main","last_synced_at":"2026-03-03T00:36:12.667Z","etag":null,"topics":["ai-background-removal","background-removal","background-removal-open-source","background-removal-toolkit","background-remover","background-remover-onnx-model","computer-vision","computer-vision-ai","docker-background-removal-open-source","image-background-removal","image-matting","image-processing","open-source-background-removal","open-source-background-remover","python-background-removal"],"latest_commit_sha":null,"homepage":"https://withoutbg.com/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/withoutbg.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-08-18T19:35:32.000Z","updated_at":"2026-03-02T23:19:26.000Z","dependencies_parsed_at":"2025-08-18T21:08:29.553Z","dependency_job_id":"cc8b21d6-40bd-4e57-ae7f-bc146649c581","html_url":"https://github.com/withoutbg/withoutbg","commit_stats":null,"previous_names":["withoutbg/withoutbg"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/withoutbg/withoutbg","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/withoutbg%2Fwithoutbg","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/withoutbg%2Fwithoutbg/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/withoutbg%2Fwithoutbg/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/withoutbg%2Fwithoutbg/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/withoutbg","download_url":"https://codeload.github.com/withoutbg/withoutbg/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/withoutbg%2Fwithoutbg/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30195570,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-06T19:07:06.838Z","status":"ssl_error","status_checked_at":"2026-03-06T18:57:34.882Z","response_time":250,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai-background-removal","background-removal","background-removal-open-source","background-removal-toolkit","background-remover","background-remover-onnx-model","computer-vision","computer-vision-ai","docker-background-removal-open-source","image-background-removal","image-matting","image-processing","open-source-background-removal","open-source-background-remover","python-background-removal"],"created_at":"2025-12-24T01:00:50.323Z","updated_at":"2026-03-06T20:03:26.330Z","avatar_url":"https://github.com/withoutbg.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"# withoutbg\n\n**AI-powered background removal with local and cloud options**\n\n[![PyPI](https://img.shields.io/pypi/v/withoutbg.svg)](https://pypi.org/project/withoutbg/)\n[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n[![Status](https://img.shields.io/badge/Next_Gen_Model-Coming_Feb_2026-blue?style=for-the-badge\u0026logo=github)](https://github.com/withoutbg/withoutbg/stargazers)\n\nRemove backgrounds from images instantly with AI. Choose between local processing (free) or withoutBG Pro (best quality).\n\n\n## ⚡ Try It in 30 Seconds\n\n![Python Package Intro](/images/python-package-intro.png)\n\n```bash\n# Install and run in one go\npip install withoutbg\n\n# Remove background from your first image\npython -c \"from withoutbg import WithoutBG; WithoutBG.opensource().remove_background('your-photo.jpg').save('result.png')\"\n```\n\nThat's it! Your photo now has a transparent background. ✨\n\n## 🤔 Which Option Should I Use?\n\n```\nProcessing 1-10 images occasionally? → withoutBG Pro (zero setup, best quality)\nProcessing 100+ images? → Local model (free, reusable)\nNeed offline processing? → Local model\nWant best possible quality? → withoutBG Pro\nBuilding commercial product? → withoutBG Pro (scalable)\nNeed fastest processing? → withoutBG Pro (optimized infrastructure)\n```\n\n**[Compare Focus vs Pro →](https://withoutbg.com/resources/compare/focus-vs-pro?utm_source=github\u0026utm_medium=withoutbg-readme\u0026utm_campaign=main-readme)**\n\n## 🚀 Quick Start\n\n### Docker (Web Interface)\n\n**[View Complete Dockerized Web App Documentation →](https://withoutbg.com/documentation/integrations/dockerized-web-app?utm_source=github\u0026utm_medium=withoutbg-readme\u0026utm_campaign=main-readme)**\n\n\n![Web Applicacation in Docker](/images/dockerized-app.png)\n```bash\ndocker run -p 80:80 withoutbg/app:latest\n\n# Open in browser\nopen http://localhost\n```\n\n✅ **Multi-platform support**: Works on Intel/AMD (amd64) and ARM (arm64) architectures\n\n### Python SDK\n\n**[View Complete Python SDK Documentation →](https://withoutbg.com/documentation/integrations/python-sdk?utm_source=github\u0026utm_medium=withoutbg-readme\u0026utm_campaign=main-readme)**\n\n```bash\n# Install (using uv - recommended)\nuv add withoutbg\n\n# Or with pip\npip install withoutbg\n```\n\n**Local Processing (Free):**\n```python\nfrom withoutbg import WithoutBG\n\n# Initialize model once, reuse for multiple images (efficient!)\nmodel = WithoutBG.opensource()\nresult = model.remove_background(\"input.jpg\")  # Returns PIL Image.Image\nresult.save(\"output.png\")\n\n# Standard PIL operations work!\nresult.show()  # View instantly\nresult.resize((500, 500))  # Resize\nresult.save(\"output.webp\", quality=95)  # Different format\n```\n\n**withoutBG Pro (Best Quality):**\n\n**[See Pro API Results →](https://withoutbg.com/resources/background-removal-results/model-pro-api?utm_source=github\u0026utm_medium=withoutbg-readme\u0026utm_campaign=main-readme)**\n\n```python\nfrom withoutbg import WithoutBG\n\n# Get your API key from withoutbg.com\nmodel = WithoutBG.api(api_key=\"sk_your_key\")\nresult = model.remove_background(\"input.jpg\")\nresult.save(\"output.png\")\n\n# Or set environment variable (recommended)\n# export WITHOUTBG_API_KEY=sk_your_key\nmodel = WithoutBG.api(api_key=\"sk_your_key\")\n```\n\n**CLI:**\n```bash\n# Process single image\nwithoutbg photo.jpg\n\n# Process entire photo album\nwithoutbg ~/Photos/vacation/ --batch --output-dir ~/Photos/vacation-no-bg/\n\n# Convert to JPEG with white background (for printing)\nwithoutbg portrait.jpg --format jpg --quality 95\n\n# Use withoutBG Pro for best quality\nexport WITHOUTBG_API_KEY=sk_your_key\nwithoutbg wedding-photo.jpg --use-api\n\n# Process and watch progress\nwithoutbg photo.jpg --verbose\n```\n\n\u003e **Don't have `uv` yet?** It's a fast, modern Python package installer - get it at [astral.sh/uv](https://astral.sh/uv)\n\n### Example Outputs from the Open Source Model\n\n**[See More Focus Model Results →](https://withoutbg.com/resources/background-removal-results/model-focus-open-source?utm_source=github\u0026utm_medium=withoutbg-readme\u0026utm_campaign=main-readme)**\n\n![Example 1](/sample-results/open-source-focus/example1.png)\n![Example 5](/sample-results/open-source-focus/example5.png)\n![Example 3](/sample-results/open-source-focus/example3.png)\n![Example 6](/sample-results/open-source-focus/example6.png)\n![Example 4](/sample-results/open-source-focus/example4.png)\n\n\n## withoutBG Zoom is coming! \n\n![withoutBG Zoom](/images/withoutBG-zoom-announcement.gif)\n\nWe are finalizing a new architecture designed to deliver superior accuracy and finer detail. Star the repo to bookmark this upgrade for your future toolkit ⭐.\n\n\n## 📦 Repository Structure\n\nThis is a **monorepo** containing multiple components:\n\n```\nwithoutbg/\n├── packages/          # Reusable packages\n│   └── python/        # Core Python SDK (published to PyPI)\n│\n├── apps/              # End-user applications\n│   └── web/           # Web application (React + FastAPI)\n│\n├── integrations/      # Third-party tool integrations\n│   └── (future: GIMP, Photoshop, Figma plugins)\n│\n├── models/            # Shared ML model files\n│   └── checkpoints/   # ONNX model files\n│\n├── docs/              # Documentation\n└── scripts/           # Development scripts\n```\n\n### Components\n\n#### 📚 [Python SDK](packages/python/)\nCore library for background removal. Published to PyPI.\n\n- **Install**: `uv add withoutbg` (or `pip install withoutbg`)\n- **Use**: Python API + CLI\n- **Models**: Focus v1.0.0 (local), withoutBG Pro\n\n#### 🌐 [Web Application](apps/web/)\nModern web interface with drag-and-drop UI.\n\n- **Stack**: React 18 + FastAPI + Nginx\n- **Deploy**: Docker Compose\n- **Features**: Batch processing, live preview\n\n#### 🔌 Integrations (Coming Soon)\nPlugins for popular creative tools.\n\n- GIMP plugin\n- Photoshop extension\n- Figma plugin\n- Blender addon\n\n## 🎯 Features\n\n- ✨ **Local Processing**: Free, private, offline with Focus v1.0.0\n- 🚀 **withoutBG Pro**: Best quality, scalable, 99.9% uptime\n- 📦 **Batch Processing**: Process multiple images efficiently\n- 🌐 **Web Interface**: Beautiful drag-and-drop UI\n- 🔧 **CLI Tool**: Command-line automation\n- 🎨 **Integrations**: Work in your favorite tools\n\n## 💡 Common Use Cases\n\n### Understanding Return Values\nAll methods return **PIL Image objects** with transparent backgrounds (RGBA mode):\n```python\nfrom withoutbg import WithoutBG\n\nmodel = WithoutBG.opensource()\nresult = model.remove_background(\"photo.jpg\")  # Returns PIL Image.Image\n\n# Save in different formats\nresult.save(\"output.png\")    # PNG with transparency\nresult.save(\"output.webp\")   # WebP with transparency\nresult.save(\"output.jpg\", quality=95)  # JPEG (no transparency)\n```\n\n### Common Gotchas\n\n**JPEG Files Don't Support Transparency:**\n```python\n# ❌ This loses transparency (JPEG doesn't support alpha):\nresult.save(\"output.jpg\")\n\n# ✅ Use PNG or WebP for transparency:\nresult.save(\"output.png\")  # Keeps alpha channel\nresult.save(\"output.webp\")  # Also works!\n```\n\n**Model Downloads Happen on First Run:**\n```python\n# First run: ~5-10 seconds (downloading ~320MB of models from HuggingFace)\nmodel = WithoutBG.opensource()  # Downloads models to cache\n\n# Second run: Instant! (models cached locally)\nmodel = WithoutBG.opensource()  # Uses cache\nresult = model.remove_background(\"photo.jpg\")  # Now processes in ~2-5s\n```\n\n**Output File Naming:**\n- Single file: `photo.jpg` → `photo-withoutbg.png`\n- Batch: Creates `photo1-withoutbg.png`, `photo2-withoutbg.png`, etc.\n- Custom: Use `--output` or `--output-dir` to specify\n\n### Batch Processing (Efficient Model Reuse)\n```python\nfrom withoutbg import WithoutBG\n\n# Initialize model once - loaded into memory\nmodel = WithoutBG.opensource()\n\n# Process multiple images - model is reused (much faster!)\nimages = [\"photo1.jpg\", \"photo2.jpg\", \"photo3.jpg\"]\nresults = model.remove_background_batch(images, output_dir=\"results/\")\n# Returns list of PIL Image objects\n```\n\n### Progress Tracking\n```python\ndef show_progress(progress):\n    print(f\"Processing: {progress * 100:.0f}%\")\n\nmodel = WithoutBG.opensource()\nresult = model.remove_background(\"photo.jpg\", progress_callback=show_progress)\n```\n\n### Error Handling\n```python\nfrom withoutbg import WithoutBG, APIError, WithoutBGError\n\ntry:\n    model = WithoutBG.api(api_key=\"sk_your_key\")\n    result = model.remove_background(\"photo.jpg\")\n    result.save(\"output.png\")\nexcept APIError as e:\n    print(f\"API error: {e}\")\nexcept WithoutBGError as e:\n    print(f\"Processing error: {e}\")\n```\n\n## ⚡ Performance\n\n| Metric | Local (CPU) | withoutBG Pro |\n|--------|-------------|---------------|\n| **First Run** | 5-10s (~320MB download) | 1-3s |\n| **Per Image** | 2-5s | 1-3s |\n| **Memory** | ~2GB RAM | None |\n| **Disk Space** | 320MB (one-time) | None |\n| **Setup** | One-time download | API key only |\n| **Cost** | Free forever | Pay per use |\n\n**Model Files (cached after first download):**\n- ISNet segmentation: 177 MB\n- Depth Anything V2: 99 MB  \n- Focus Matting: 27 MB\n- Focus Refiner: 15 MB\n- **Total: ~320 MB** (one-time download, cached locally)\n\n**💡 Pro Tip:** For batch processing, initialize the model once and reuse it - this is **10-100x faster** than reinitializing for each image!\n\n## 🔧 Troubleshooting\n\n**Model download fails?**  \n- Check your internet connection\n- Models are downloaded from HuggingFace on first run (~320MB total)\n- Or use local model files (see [Configuration](packages/python/README.md#configuration))\n\n**Out of memory?**  \n- Try processing smaller images or use withoutBG Pro\n- Reduce batch size when processing multiple images\n\n**Import errors or \"module not found\"?**\n```bash\n# Make sure you're in the right environment\nwhich python  # Check your Python path\npip list | grep withoutbg  # Verify installation\n\n# If using virtual environment\nsource venv/bin/activate  # Activate first\npip install withoutbg  # Then install\n```\n\n**API key invalid?**  \n- Get your API key from [withoutbg.com](https://withoutbg.com)\n- Set environment variable: `export WITHOUTBG_API_KEY=sk_your_key`\n\n**Slow processing on first run?**  \n- Normal! Models are being downloaded (~320MB)\n- Subsequent runs will be much faster (~2-5s per image)\n\n## 📖 Documentation\n\n- **[Python SDK Docs](packages/python/README.md)** - Complete API reference and examples\n- **[Python SDK Documentation](https://withoutbg.com/documentation/integrations/python-sdk?utm_source=github\u0026utm_medium=withoutbg-readme\u0026utm_campaign=main-readme)** - Online documentation\n- **[Web App Docs](apps/web/README.md)** - Deployment and development guide\n- **[Dockerized Web App Documentation](https://withoutbg.com/documentation/integrations/dockerized-web-app?utm_source=github\u0026utm_medium=withoutbg-readme\u0026utm_campaign=main-readme)** - Online documentation\n- **[withoutBG Pro API Results](https://withoutbg.com/resources/background-removal-results/model-pro-api?utm_source=github\u0026utm_medium=withoutbg-readme\u0026utm_campaign=main-readme)** - See example outputs\n- **[Focus Model Results](https://withoutbg.com/resources/background-removal-results/model-focus-open-source?utm_source=github\u0026utm_medium=withoutbg-readme\u0026utm_campaign=main-readme)** - See example outputs\n- **[Compare Focus vs Pro](https://withoutbg.com/resources/compare/focus-vs-pro?utm_source=github\u0026utm_medium=withoutbg-readme\u0026utm_campaign=main-readme)** - Model comparison\n\n## 🛠️ Development\n\n### Python Package\n\n```bash\ncd packages/python\n\n# Install in development mode (using uv - recommended)\nuv sync --extra dev\n\n# Or with pip\npip install -e \".[dev]\"\n\n# Run tests\npytest\n\n# Format code\nblack src/ tests/\nruff check src/ tests/\n```\n\n### Web Application\n\n```bash\n# Development mode (hot-reload)\ndocker-compose -f apps/web/docker-compose.yml up\n\n# Or run components separately\ncd apps/web/backend\nuv sync\nuvicorn app.main:app --reload\n\ncd apps/web/frontend\nnpm install\nnpm run dev\n```\n\n## 🌟 Latest Release: Focus v1.0.0\n\nOur most advanced open source model with:\n\n- ✅ **Significantly better edge detail** - Crisp, clean edges\n- ✅ **Superior hair/fur handling** - Natural-looking fine details  \n- ✅ **Better generalization** - Works on diverse image types\n\nSee example outputs above and check [sample-results/](sample-results/) for more visual comparisons.\n\n## 📄 License\n\nApache License 2.0 - see [LICENSE](LICENSE)\n\n### Third-Party Components\n- **Depth Anything V2**: Apache 2.0 License (only vits model)\n- **ISNet**: Apache 2.0 License\n\n### Acknowledgements\n- **[segmentation-models-pytorch](https://github.com/qubvel-org/segmentation_models.pytorch)**: MIT License (used to train matting/refiner models)\n\nSee [THIRD_PARTY_LICENSES.md](THIRD_PARTY_LICENSES.md) for complete attribution.\n\n## 🤝 Contributing\n\nWe welcome contributions! See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.\n\n1. Fork the repository\n2. Create a feature branch\n3. Make your changes\n4. Add tests\n5. Submit a pull request\n\n## 📧 Support\n\n- **Bug Reports**: [GitHub Issues](https://github.com/withoutbg/withoutbg/issues)\n- **Feature Requests**: [GitHub Discussions](https://github.com/withoutbg/withoutbg/discussions)\n- **Commercial Support**: [contact@withoutbg.com](mailto:contact@withoutbg.com)\n\n## ⭐ Star History\n\n[![Star History Chart](https://api.star-history.com/svg?repos=withoutbg/withoutbg\u0026type=Date)](https://star-history.com/#withoutbg/withoutbg\u0026Date)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwithoutbg%2Fwithoutbg","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwithoutbg%2Fwithoutbg","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwithoutbg%2Fwithoutbg/lists"}