What can you do with it?
The/image-background-removal
command enables you to automatically remove backgrounds from images using the advanced 851-labs background remover model. You can isolate subjects from photos, create transparent backgrounds for product images, prepare images for compositing, generate cutouts for graphic design, and clean up photos for professional use without manual editing.
How to use it?
Basic Command Structure
Parameters
Required:image
- The image to process (URL or uploaded file)
threshold
- Threshold for hard segmentation: 0.0-1.0 (defaults to 0). If 0.0, uses soft alphareverse
- If true, remove the foreground instead of the background (boolean, defaults to false)background_type
- Background type (defaults to “rgba”). Options: ‘rgba’, ‘map’, ‘green’, ‘white’, [R,G,B] array, ‘blur’, ‘overlay’, or path to an imageformat
- Output format (defaults to “png”). Examples: png, jpgfileLinksExpireInDays
- How long generated files remain accessible: 1-7 days (defaults to 7)fileLinksExpireInMinutes
- How long generated files remain accessible in minutes (takes precedence over days)
Response Format
The command returns:fileLinksExpireInDays
parameter.
Examples
Basic Background Removal
Product Photography
White Background Replacement
Green Screen Effect
Foreground Removal (Reverse)
Custom Color Background
Blur Background Effect
Batch Processing Setup
Notes
Model Capabilities:- High-quality edge detection and preservation
- Supports various background replacement options
- Excellent for both portrait and product photography
- Fast processing (typically 5-15 seconds)
- Handles complex subjects like hair and fur
- Input: JPEG/JPG, PNG, WebP, GIF
- Output: PNG (for transparency), JPG (for solid backgrounds)
- Use PNG format for transparent backgrounds
- Use JPG for solid color backgrounds to reduce file size
- Higher threshold values create harder edges
- Lower threshold values (including 0) create softer, more natural edges
- Works best with clear subject-background contrast
- Processing time may vary based on image complexity
- Very fine details like hair may require manual touch-up
- Performance depends on lighting and contrast in original image
Model Parameters (851-labs/background-remover)
Background Removal Parameters
- image (required): Input image (URI format)
- threshold: Threshold for hard segmentation (0.0-1.0, default: 0). If 0.0, uses soft alpha
- reverse: If true, remove the foreground instead of the background (boolean, default: false)
- background_type: Background type (default: “rgba”). Options: ‘rgba’, ‘map’, ‘green’, ‘white’, [R,G,B] array, ‘blur’, ‘overlay’, or path to an image
- format: Output format (default: “png”). Examples: png, jpg