Background Removal
bg-remove
Premium Feature
Background Removal is currently available for Imgix customers on our Premium plans. If you’re interested in this feature, please contact our sales team for more information.
The background removal parameter enables users to deliver images with different backgrounds. The tool detects the primary subject in an image, such as a car, product, person, animal, graphic, or other transportation, and automatically applies removal settings based on the subject identified. This process isolates the main subject while removing the background, allowing for a clear focus on the intended object. Subject-based detection and cropping offer a straightforward solution for cases requiring a clean subject with no background. Once a background is removed, the image can be transformed or combined with other images.
Supported Image Formats
We support the following Origin image formats by default:
- JPEG
- PNG
- WEBP
- HEIF/HEIC
- TIFF
For a complete list of supported image formats, see which image formats can be served with imgix.
Supported Image Size and Resolution
Images larger than 12 megabytes or 50 megapixels will be optimized for background removal by default.
Output images have a limit of 10MP and will be resized to fit within this limit. (Example: An input image of 8000x5000 pixels will be resized to 4000x2500 pixels.)
How to Use the Parameter
To apply this parameter, add bg-remove=true
to your image URL. Although processing background removal may take up to a minute, most requests are completed in a few seconds. Once background removal is completed, the request will be cached, and subsequent requests will return in a much faster response time.
Use Cases
For E-commerce
The Background Removal parameter can automate product image workflows for e-commerce sites. Instead of manually removing an image from each background, you can append a parameter to remove all the backgrounds at scale.

Digital Camera

Premium Headphones

Ultra Slim Laptop

Smart Power Outlet

Smartphone Pro

Wireless Speakers
Image Composition
You can combine background removal with other Imgix parameters to create new image compositions. For example, you can:
- Replace the background with a solid color
- Use the image as a watermark on another image
- Blend an image onto a product
Recommendations
- Images with good lighting and high contrast between the foreground and background work best for background removal.
- Blurry or single-color backgrounds are preferred.
- Use an image with a sharp foreground since blurry foregrounds may be removed.
- For product images, the whole product should be visible and not cut off.
- The main subject or product should be in focus.
- Avoid hard shadows and reflections.
- Natural and eye-level angles are best.
Caveats
Preprocessing
Background removal can be a time-intensive process. To ensure your background-removed image is ready when a customer requests it, as soon as you know that you want to remove the background, issue a request to the Imgix rendering API with bg-remove=true
.
Handling Edge Cases
Background removal will fail gracefully by default. If background removal fails, the Origin image will be served in its place. To override this behavior, use bg-remove-fallback=false
.
The X-Imgix-Bg-Remove-Failure-Reason
header will detail the reason for failure and will be present when bg-remove-fallback=false
is enabled or not.
Note: a purge request is required to replace or reprocess an image.
Async Responses
Fallback Enabled
For many requests, the first time a background is removed, it will return within a few seconds. During higher loads, you may receive a temporary response while we’re processing your request. This temporary response will send a 200
status code or a 423
error if bg-remove-fallback=false
is present. Regardless of the bg-remove-fallback
setting, the cached response will be set to a short interval so that the requested background removal image can be returned.
This temporary response will also have the following header:
X-Imgix-Bg-Remove-Failure-Reason: Processing background removal request.
You can continue to retry the request until you receive the processed image without the failure header. All subsequent requests will return the image with the background removed.
AI Composition
The Rendering API processes multiple AI transformations asynchronously and requires a few seconds to complete. When present, multiple AI transformations get rendered in this order:
Read this tutorial to learn more about chaining AI transformations.
Questions
Please reach out to your Account Manager or to Support if you have any questions or feedback.