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