Remove Background API¶
Pricing¶
25 credits per request
Fixed cost regardless of image size or complexity.
Overview¶
The Remove Background API uses AI (rembg with U²-Net models) to automatically remove backgrounds from images, producing PNG files with transparency. Perfect for creating product images, portraits, and graphics without backgrounds.
Domain: edit.revidapi.com
Endpoint¶
POST https://api.revidapi.com/paid/image/remove/background
Authentication: Required - Header x-api-key
Request¶
Headers¶
x-api-key: Required. Your API key for authentication.Content-Type: Required. Must bemultipart/form-data.
Form Parameters¶
Required Parameters¶
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
file |
file (upload) | ✅ Yes | - | Image file to remove background from (PNG, JPG, JPEG, WEBP, BMP) |
Optional Parameters¶
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
model |
string | ❌ No | u2net |
AI model to use for background removal |
Supported Models¶
| Model | Best For | Speed | Quality |
|---|---|---|---|
u2net ⭐ |
General use (default) | Fast | High |
u2net_human_seg |
Human portraits | Fast | High |
u2netp |
Fast processing | Very Fast | Medium |
u2net_cloth_seg |
Clothing items | Fast | High |
silueta |
Portraits | Fast | High |
isnet-general-use |
Highest quality | Slower | Very High |
Supported Formats¶
- Input: PNG, JPG, JPEG, WEBP, BMP
- Output: PNG (with transparency)
Response¶
Immediate Response (Task Created)¶
POST endpoint returns immediately with task_id:
{
"success": true,
"task_id": "a1b2c3d4-e5f6-g7h8-i9j0-k1l2m3n4o5p6",
"status": "pending",
"message": "Background removal started",
"endpoints": {
"check_status": "/api/get/{task_id}",
"download_image": "/output/{filename} (after completion)"
}
}
Task Status (GET)¶
Use task_id to poll status:
GET https://edit.revidapi.com/api/get/{task_id}
⏳ Processing¶
{
"status": "processing",
"message": "Removing background from image...",
"progress": 50,
"created_at": "2025-01-24T10:30:00.000000",
"completed_at": null,
"result": null
}
✅ Completed¶
{
"status": "completed",
"message": "Background removal completed successfully",
"progress": 100,
"created_at": "2025-01-24T10:30:00.000000",
"completed_at": "2025-01-24T10:30:05.123456",
"result": {
"image_url": "https://edit.revidapi.com/output/a1b2c3d4-e5f6-g7h8-i9j0-k1l2m3n4o5p6_output.png",
"image_filename": "a1b2c3d4-e5f6-g7h8-i9j0-k1l2m3n4o5p6_output.png",
"input_size": 524288,
"output_size": 314572,
"input_size_kb": 512.0,
"output_size_kb": 307.2,
"elapsed_seconds": 2.45,
"model": "u2net"
}
}
❌ Failed¶
{
"status": "failed",
"message": "Background removal failed: Invalid image format",
"progress": 0,
"created_at": "2025-01-24T10:30:00.000000",
"completed_at": "2025-01-24T10:30:01.123456",
"result": {
"error": "Unsupported image format: gif. Supported: png, jpg, jpeg, webp, bmp"
}
}
Result Fields¶
| Field | Type | Description |
|---|---|---|
image_url |
string | URL to download the processed image |
image_filename |
string | Filename of the output image |
input_size |
integer | Input file size in bytes |
output_size |
integer | Output file size in bytes |
input_size_kb |
number | Input file size in KB |
output_size_kb |
number | Output file size in KB |
elapsed_seconds |
number | Processing time in seconds |
model |
string | Model used for processing |
Note: Download URLs are temporary and may expire after a period of time.
Example Requests¶
Example 1: Using cURL¶
curl -X POST \
https://api.revidapi.com/paid/image/remove/background \
-H "x-api-key: YOUR_API_KEY" \
-F "file=@/path/to/image.jpg" \
-F "model=u2net"
¶
curl -X POST \
https://api.revidapi.com/paid/image/remove/background \
-H "x-api-key: YOUR_API_KEY" \
-F "file=@/path/to/image.jpg" \
-F "model=u2net"
Processing Time¶
| Image Size | Processing Time |
|---|---|
| < 1 MB | ~1-3 seconds |
| 1-5 MB | ~3-8 seconds |
| 5-10 MB | ~8-15 seconds |
| > 10 MB | ~15-30 seconds |
Times may vary based on model selection and server load.
Use Cases¶
1. E-commerce Product Images¶
Remove backgrounds from product photos for clean, professional listings.
2. Portrait Photography¶
Remove backgrounds from portraits for professional headshots or profile pictures.
3. Social Media Content¶
Create eye-catching graphics with transparent backgrounds.
4. Logo Extraction¶
Extract logos from images with complex backgrounds.
5. Design Work¶
Prepare images for design projects requiring transparency.
Best Practices¶
- Model Selection:
- Use
u2netfor general use (default) - Use
u2net_human_segfor portraits -
Use
isnet-general-usefor highest quality (slower) -
File Formats:
- Upload in PNG or JPG format
-
Output is always PNG with transparency
-
Image Quality:
- Higher resolution images produce better results
-
Avoid heavily compressed images
-
Polling:
- Check status every 1-2 seconds
-
Implement timeout handling (30-60 seconds)
-
Error Handling:
- Handle unsupported formats gracefully
- Check file size limits before upload
Limitations¶
- Max file size: Typically 10-20 MB (check server limits)
- Supported formats: PNG, JPG, JPEG, WEBP, BMP only
- Processing timeout: 60 seconds per request
- Download URLs: May expire after a period (download promptly)
Troubleshooting¶
Error: Unsupported format¶
Cause: Image format not supported
Solution: Convert image to PNG, JPG, JPEG, WEBP, or BMP before upload
Error: File too large¶
Cause: Image exceeds size limit
Solution: Compress or resize image before upload
Error: rembg not available¶
Cause: Background removal service temporarily unavailable
Solution: Try again later or contact support
Poor quality results¶
Cause: Image quality, lighting, or model selection
Solution:
- Use higher quality input images
- Try different models (e.g., isnet-general-use for better quality)
- Ensure good contrast between subject and background