An open-source, high-accuracy background removal tool powered by deep learning models. This project leverages the withoutbg and rembg engines to provide superior results for removing backgrounds from images.
- High Accuracy: Utilizes advanced AI models to precisely separate foregrounds from backgrounds.
- Dual Engine Support: Choose between
withoutbg(default, high accuracy) andrembgengines for your specific needs. - Batch Processing: Process multiple images at once and download results as a ZIP file.
- Image Composition: Easily add solid colors or custom images as new backgrounds for your processed images.
- Web Interface: Simple and intuitive Django-based web interface.
- API Support: RESTful endpoints for integrating background removal into your own applications.
- Backend: Django
- AI/ML Engines:
withoutbg,rembg,onnxruntime - Image Processing: Pillow (PIL)
- Package Management: uv / pip
- Python 3.12 or higher
uvpackage manager (recommended) orpip
-
Clone the Repository
git clone https://github.com/Cyber24BD/python-image-bg-remove.git cd python-image-bg-remove -
Install Dependencies
Using
uv:uv sync
Or using
pip:pip install -r requirements.txt
(Note: If
requirements.txtis not present, generate it frompyproject.tomlor install dependencies manually.) -
Run Migrations
uv run manage.py migrate # or python manage.py migrate -
Start the Development Server
uv run manage.py runserver # or python manage.py runserver -
Access the Application Open your browser and navigate to
http://127.0.0.1:8000.
- Go to the home page.
- Upload an image (JPEG, PNG, WebP).
- Select the processing engine (
withoutbgfor higher accuracy). - View the result, download it, or edit the background.
POST /upload/
- image: (File) The image file to process.
- engine: (String)
withoutbgorrembg.
Contributions are welcome! Please feel free to submit a Pull Request.