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|
|
|
|
| 1 |
+
# Quick Start Guide
|
| 2 |
+
|
| 3 |
+
Get up and running with BackgroundFX Pro in just 5 minutes! This guide will walk you through the essential steps to start removing backgrounds from your images.
|
| 4 |
+
|
| 5 |
+
## π Installation Options
|
| 6 |
+
|
| 7 |
+
### Option 1: Docker (Recommended)
|
| 8 |
+
|
| 9 |
+
```bash
|
| 10 |
+
# Clone the repository
|
| 11 |
+
git clone https://github.com/backgroundfx/backgroundfx-pro.git
|
| 12 |
+
cd backgroundfx-pro
|
| 13 |
+
|
| 14 |
+
# Start with Docker Compose
|
| 15 |
+
docker-compose up -d
|
| 16 |
+
|
| 17 |
+
# Access the application
|
| 18 |
+
open http://localhost:3000
|
| 19 |
+
```
|
| 20 |
+
|
| 21 |
+
### Option 2: Local Development
|
| 22 |
+
|
| 23 |
+
```bash
|
| 24 |
+
# Backend setup
|
| 25 |
+
cd api
|
| 26 |
+
python -m venv venv
|
| 27 |
+
source venv/bin/activate # On Windows: venv\Scripts\activate
|
| 28 |
+
pip install -r requirements.txt
|
| 29 |
+
uvicorn main:app --reload
|
| 30 |
+
|
| 31 |
+
# Frontend setup (new terminal)
|
| 32 |
+
cd web
|
| 33 |
+
npm install
|
| 34 |
+
npm run dev
|
| 35 |
+
```
|
| 36 |
+
|
| 37 |
+
### Option 3: Cloud Deployment
|
| 38 |
+
|
| 39 |
+
[](https://aws.amazon.com/marketplace/pp/backgroundfx)
|
| 40 |
+
[](https://cloud.google.com/marketplace)
|
| 41 |
+
[](https://azuremarketplace.microsoft.com)
|
| 42 |
+
|
| 43 |
+
## π API Authentication
|
| 44 |
+
|
| 45 |
+
### 1. Register for an API Key
|
| 46 |
+
|
| 47 |
+
```bash
|
| 48 |
+
curl -X POST https://api.backgroundfx.pro/v1/auth/register \
|
| 49 |
+
-H "Content-Type: application/json" \
|
| 50 |
+
-d '{
|
| 51 |
+
"email": "your@email.com",
|
| 52 |
+
"password": "secure_password",
|
| 53 |
+
"name": "Your Name"
|
| 54 |
+
}'
|
| 55 |
+
```
|
| 56 |
+
|
| 57 |
+
### 2. Get Your Access Token
|
| 58 |
+
|
| 59 |
+
```bash
|
| 60 |
+
curl -X POST https://api.backgroundfx.pro/v1/auth/login \
|
| 61 |
+
-H "Content-Type: application/json" \
|
| 62 |
+
-d '{
|
| 63 |
+
"email": "your@email.com",
|
| 64 |
+
"password": "secure_password"
|
| 65 |
+
}'
|
| 66 |
+
```
|
| 67 |
+
|
| 68 |
+
Response:
|
| 69 |
+
```json
|
| 70 |
+
{
|
| 71 |
+
"token": "eyJhbGciOiJIUzI1NiIs...",
|
| 72 |
+
"user": {
|
| 73 |
+
"id": "uuid",
|
| 74 |
+
"email": "your@email.com",
|
| 75 |
+
"plan": "free"
|
| 76 |
+
}
|
| 77 |
+
}
|
| 78 |
+
```
|
| 79 |
+
|
| 80 |
+
## πΌοΈ Your First Background Removal
|
| 81 |
+
|
| 82 |
+
### Using the Web Interface
|
| 83 |
+
|
| 84 |
+
1. Navigate to http://localhost:3000
|
| 85 |
+
2. Click "Upload Image" or drag and drop
|
| 86 |
+
3. Wait for processing (typically 1-2 seconds)
|
| 87 |
+
4. Download your result!
|
| 88 |
+
|
| 89 |
+
### Using the API
|
| 90 |
+
|
| 91 |
+
```bash
|
| 92 |
+
# Remove background from an image
|
| 93 |
+
curl -X POST https://api.backgroundfx.pro/v1/process/remove-background \
|
| 94 |
+
-H "Authorization: Bearer YOUR_TOKEN" \
|
| 95 |
+
-F "file=@/path/to/image.jpg" \
|
| 96 |
+
-F "quality=high" \
|
| 97 |
+
-F "return_mask=true"
|
| 98 |
+
```
|
| 99 |
+
|
| 100 |
+
### Using Python SDK
|
| 101 |
+
|
| 102 |
+
```python
|
| 103 |
+
from backgroundfx import BackgroundFX
|
| 104 |
+
|
| 105 |
+
# Initialize client
|
| 106 |
+
client = BackgroundFX(api_key="YOUR_API_KEY")
|
| 107 |
+
|
| 108 |
+
# Remove background
|
| 109 |
+
result = client.remove_background(
|
| 110 |
+
image_path="photo.jpg",
|
| 111 |
+
quality="high",
|
| 112 |
+
return_mask=True
|
| 113 |
+
)
|
| 114 |
+
|
| 115 |
+
# Save result
|
| 116 |
+
result.save("output.png")
|
| 117 |
+
```
|
| 118 |
+
|
| 119 |
+
### Using JavaScript SDK
|
| 120 |
+
|
| 121 |
+
```javascript
|
| 122 |
+
import { BackgroundFX } from 'backgroundfx-js';
|
| 123 |
+
|
| 124 |
+
// Initialize client
|
| 125 |
+
const client = new BackgroundFX({ apiKey: 'YOUR_API_KEY' });
|
| 126 |
+
|
| 127 |
+
// Remove background
|
| 128 |
+
const result = await client.removeBackground({
|
| 129 |
+
file: imageFile,
|
| 130 |
+
quality: 'high',
|
| 131 |
+
returnMask: true
|
| 132 |
+
});
|
| 133 |
+
|
| 134 |
+
// Get result URL
|
| 135 |
+
console.log(result.imageUrl);
|
| 136 |
+
```
|
| 137 |
+
|
| 138 |
+
## π¨ Adding Custom Backgrounds
|
| 139 |
+
|
| 140 |
+
### Solid Color Background
|
| 141 |
+
|
| 142 |
+
```python
|
| 143 |
+
# Replace with solid color
|
| 144 |
+
result = client.replace_background(
|
| 145 |
+
image_id="result_id",
|
| 146 |
+
background="#FF5733" # Hex color
|
| 147 |
+
)
|
| 148 |
+
```
|
| 149 |
+
|
| 150 |
+
### Gradient Background
|
| 151 |
+
|
| 152 |
+
```python
|
| 153 |
+
# Replace with gradient
|
| 154 |
+
result = client.replace_background(
|
| 155 |
+
image_id="result_id",
|
| 156 |
+
background="linear-gradient(45deg, #667eea, #764ba2)"
|
| 157 |
+
)
|
| 158 |
+
```
|
| 159 |
+
|
| 160 |
+
### Image Background
|
| 161 |
+
|
| 162 |
+
```python
|
| 163 |
+
# Replace with another image
|
| 164 |
+
result = client.replace_background(
|
| 165 |
+
image_id="result_id",
|
| 166 |
+
background_path="background.jpg"
|
| 167 |
+
)
|
| 168 |
+
```
|
| 169 |
+
|
| 170 |
+
### AI-Generated Background
|
| 171 |
+
|
| 172 |
+
```python
|
| 173 |
+
# Generate and apply AI background
|
| 174 |
+
background = client.generate_background(
|
| 175 |
+
prompt="sunny beach with palm trees",
|
| 176 |
+
style="realistic"
|
| 177 |
+
)
|
| 178 |
+
|
| 179 |
+
result = client.replace_background(
|
| 180 |
+
image_id="result_id",
|
| 181 |
+
background_id=background.id
|
| 182 |
+
)
|
| 183 |
+
```
|
| 184 |
+
|
| 185 |
+
## π¦ Batch Processing
|
| 186 |
+
|
| 187 |
+
Process multiple images at once:
|
| 188 |
+
|
| 189 |
+
```python
|
| 190 |
+
# Process batch of images
|
| 191 |
+
job = client.process_batch(
|
| 192 |
+
images=["photo1.jpg", "photo2.jpg", "photo3.jpg"],
|
| 193 |
+
options={
|
| 194 |
+
"quality": "high",
|
| 195 |
+
"model": "u2net",
|
| 196 |
+
"return_mask": True
|
| 197 |
+
}
|
| 198 |
+
)
|
| 199 |
+
|
| 200 |
+
# Check job status
|
| 201 |
+
while job.status != "completed":
|
| 202 |
+
job.refresh()
|
| 203 |
+
print(f"Progress: {job.progress}%")
|
| 204 |
+
time.sleep(1)
|
| 205 |
+
|
| 206 |
+
# Get results
|
| 207 |
+
for result in job.results:
|
| 208 |
+
result.save(f"output_{result.id}.png")
|
| 209 |
+
```
|
| 210 |
+
|
| 211 |
+
## π₯ Video Processing
|
| 212 |
+
|
| 213 |
+
Remove backgrounds from videos:
|
| 214 |
+
|
| 215 |
+
```python
|
| 216 |
+
# Process video
|
| 217 |
+
video_job = client.process_video(
|
| 218 |
+
video_path="input.mp4",
|
| 219 |
+
options={
|
| 220 |
+
"quality": "high",
|
| 221 |
+
"fps": 30,
|
| 222 |
+
"background": "#00FF00" # Green screen
|
| 223 |
+
}
|
| 224 |
+
)
|
| 225 |
+
|
| 226 |
+
# Monitor progress
|
| 227 |
+
video_job.on_progress(lambda p: print(f"Processing: {p}%"))
|
| 228 |
+
|
| 229 |
+
# Wait for completion
|
| 230 |
+
video_job.wait()
|
| 231 |
+
|
| 232 |
+
# Download result
|
| 233 |
+
video_job.download("output.mp4")
|
| 234 |
+
```
|
| 235 |
+
|
| 236 |
+
## βοΈ Configuration Options
|
| 237 |
+
|
| 238 |
+
### Processing Models
|
| 239 |
+
|
| 240 |
+
| Model | Speed | Quality | Best For |
|
| 241 |
+
|-------|-------|---------|----------|
|
| 242 |
+
| `rembg` | Fast | Good | General use |
|
| 243 |
+
| `u2net` | Medium | Excellent | Complex edges |
|
| 244 |
+
| `deeplab` | Slow | Best | Professional |
|
| 245 |
+
| `custom` | Varies | Highest | Specific use cases |
|
| 246 |
+
|
| 247 |
+
### Quality Settings
|
| 248 |
+
|
| 249 |
+
| Setting | Resolution | Processing Time | Use Case |
|
| 250 |
+
|---------|------------|-----------------|----------|
|
| 251 |
+
| `low` | 512px | ~0.5s | Previews |
|
| 252 |
+
| `medium` | 1024px | ~1s | Web use |
|
| 253 |
+
| `high` | 2048px | ~2s | Print |
|
| 254 |
+
| `ultra` | 4096px | ~5s | Professional |
|
| 255 |
+
|
| 256 |
+
## π Real-time Processing with WebSockets
|
| 257 |
+
|
| 258 |
+
```javascript
|
| 259 |
+
// Connect to WebSocket
|
| 260 |
+
const ws = new WebSocket('wss://api.backgroundfx.pro/ws');
|
| 261 |
+
|
| 262 |
+
// Subscribe to job updates
|
| 263 |
+
ws.send(JSON.stringify({
|
| 264 |
+
action: 'subscribe',
|
| 265 |
+
job_id: 'job_uuid'
|
| 266 |
+
}));
|
| 267 |
+
|
| 268 |
+
// Handle updates
|
| 269 |
+
ws.onmessage = (event) => {
|
| 270 |
+
const data = JSON.parse(event.data);
|
| 271 |
+
console.log(`Progress: ${data.progress}%`);
|
| 272 |
+
};
|
| 273 |
+
```
|
| 274 |
+
|
| 275 |
+
## π Usage Monitoring
|
| 276 |
+
|
| 277 |
+
Check your API usage:
|
| 278 |
+
|
| 279 |
+
```bash
|
| 280 |
+
curl -X GET https://api.backgroundfx.pro/v1/user/usage \
|
| 281 |
+
-H "Authorization: Bearer YOUR_TOKEN"
|
| 282 |
+
```
|
| 283 |
+
|
| 284 |
+
Response:
|
| 285 |
+
```json
|
| 286 |
+
{
|
| 287 |
+
"images_processed": 1234,
|
| 288 |
+
"videos_processed": 56,
|
| 289 |
+
"storage_used_mb": 2456,
|
| 290 |
+
"api_calls": 8901,
|
| 291 |
+
"billing_period": "2024-01-01 to 2024-01-31",
|
| 292 |
+
"plan_limits": {
|
| 293 |
+
"images_per_month": 10000,
|
| 294 |
+
"storage_gb": 100,
|
| 295 |
+
"api_calls_per_hour": 1000
|
| 296 |
+
}
|
| 297 |
+
}
|
| 298 |
+
```
|
| 299 |
+
|
| 300 |
+
## π¨ Common Issues
|
| 301 |
+
|
| 302 |
+
### Issue: "File too large"
|
| 303 |
+
**Solution**: Ensure your file is under 50MB for images, 500MB for videos.
|
| 304 |
+
|
| 305 |
+
### Issue: "Rate limit exceeded"
|
| 306 |
+
**Solution**: Upgrade your plan or implement request throttling.
|
| 307 |
+
|
| 308 |
+
### Issue: "Poor edge quality"
|
| 309 |
+
**Solution**: Use higher quality settings or the `u2net` model.
|
| 310 |
+
|
| 311 |
+
### Issue: "Processing timeout"
|
| 312 |
+
**Solution**: Use batch processing for multiple files or reduce file size.
|
| 313 |
+
|
| 314 |
+
## π Next Steps
|
| 315 |
+
|
| 316 |
+
- **[API Reference](../api/README.md)** - Complete API documentation
|
| 317 |
+
- **[Tutorials](tutorials/)** - Step-by-step guides
|
| 318 |
+
- **[Best Practices](best-practices.md)** - Optimization tips
|
| 319 |
+
- **[Examples](https://github.com/backgroundfx/examples)** - Sample code
|
| 320 |
+
|
| 321 |
+
## π Need Help?
|
| 322 |
+
|
| 323 |
+
- π§ Email: support@backgroundfx.pro
|
| 324 |
+
- π¬ Discord: [Join our community](https://discord.gg/backgroundfx)
|
| 325 |
+
- π Forum: [Community Forum](https://forum.backgroundfx.pro)
|
| 326 |
+
|
| 327 |
+
---
|
| 328 |
+
|
| 329 |
+
**Ready to build?** Start integrating BackgroundFX Pro into your application today!
|