SnapErase (v1.2.0) is a professional-grade, AI-powered background removal tool. It combines the power of deep learning with a streamlined, secure web interface to provide instant, high-quality image processing.
Features • Tech Stack • Installation • API Documentation • Security
- Precision Background Removal: Leverages the
u2netmodel (viarembg) for complex edge detection. - Interactive UI:
- Before/After Demo: Real-time comparison slider to see the AI magic in action.
- Adaptive Navbar: Smooth glassmorphism transition on scroll for a premium feel.
- Modern Design: Sleek, AI-native interface featuring Outfit typography and glassmorphism panels.
- Enterprise-Grade Security: Hardened with CSRF protection, rate limiting, and strict CSP headers.
- High Performance:
- In-Memory Buffer: Processing happens in RAM to minimize disk I/O.
- Smart Caching: Hash-based deduplication to serve repeat images instantly.
- Cloud Native: Optimized multistage Docker build with automated healthchecks and non-root security.
- Backend: Python 3.10+, Flask
- AI Core:
rembg(U2-Net), PIL (Pillow) - Frontend: Modern Vanilla CSS (Flexbox/Grid), Vanilla JavaScript (ES6+), Lucide Icons
- Security: Flask-WTF (CSRF), Flask-Limiter (Rate Limiting)
- Infrastructure: Gunicorn, Docker (Multistage), Healthcheck APIs
-
Clone the repository:
git clone https://github.com/RishiBuilds/SnapErase.git cd SnapErase -
Environment Configuration:
python -m venv venv source venv/bin/activate # Windows: venv\Scripts\activate pip install -r requirements.txt
-
Configure Environment Variables: Create a
.envfile from the provided template:SECRET_KEY=your_secure_random_key FLASK_DEBUG=False MAX_CONTENT_LENGTH=16777216
-
Launch Application:
python app.py
Access the dashboard at
http://localhost:5000.
SnapErase uses a multistage build for a lean production image:
docker build -t snaperase:latest .
docker run -d -p 5000:5000 --name snaperase_app snaperase:latestThe container includes a built-in healthcheck that monitors the service status every 30 seconds.
POST /remove-bg
| Parameter | Type | Required | Description |
|---|---|---|---|
image |
File | Yes | The image file (PNG, JPG, JPEG, WEBP) |
format |
String | No | image (direct download) or json (Base64) |
Sample JSON Response:
{
"success": true,
"image": "data:image/png;base64,iVBORw0KGgoAAAANSUh..."
}SnapErase implements several layers of protection:
- Rate Limiting: Prevents API abuse (default: 200/day, 50/hour).
- MIME Validation: Strict checking of magic bytes to prevent polyglot file attacks.
- Non-Root Execution: Docker container runs as a non-privileged
appuser. - Header Hardening: CSP, X-Content-Type-Options, X-Frame-Options, and X-XSS-Protection.
Developed with passion by Rishi Builds
Released under the MIT License