Background Removal bg-remove

The background removal parameter will enable users to deliver images with different backgrounds. By removing the background, users can combine the modified image with other elements to open up various options when working with multiple assets in the same image.

Background removal can be enabled for an entire Account or a specific Source. Please get in touch with your Account Manager or imgix’s Support team to activate the feature.

Requirements

  • Origin Image must be either JPG or PNG with a file size of up to 12 MB.
    • auto=format functionality will still work with bg-remove

Limitations

This feature is currently available to limited customers and if you are using this you are participating in a special early release. You can use this feature in production workflows but we reserve the right to change the API behavior in the future.

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. While the removal is processing, you may get a non-200 status code and your request might not return an image, but once the removal is done processing all subsequent requests will have the background removed.

Because of the resource-intensive nature of background removal, the rate limit on this feature is lower than many others in the rendering API. If we are currently processing a high volume of background removals you may receive a 429 status code which indicates you should wait before retrying your request.

Please reach out to your Account Manager or to Support if you have any questions or feedback.

How to Use the Parameter

To apply this parameter, add bg-remove=true to your image URL. It may take up to a minute to process background removal. Once a background removal completes, the request will be cached, and subsequent requests will return in a much faster response time.

Woman smiling on painted background https://assets.imgix.net/woman-smiling-on-painted-background.jpeg

EX: Image with the Background Removed

Woman smiling with background removed https://assets.imgix.net/woman-smiling-on-painted-background.jpeg?bg-remove=true&auto=compress,format&w=620

EX: Filling in the transparent background with a new color

Woman smiling with filled in background https://assets.imgix.net/woman-smiling-on-painted-background.jpeg?bg-remove=true&bg=DB2BBBD9&auto=compress,format&w=620

EX: Using a Watermark

Woman smiling in front of mountains https://assets.imgix.net/mountains.jpeg?w=620&auto=compress%2Cformat&mark-pad=0&mark-align=bottom%2Ccenter&mark-w=620&mark64=aHR0cHM6Ly9hc3NldHMuaW1naXgubmV0L3dvbWFuLXNtaWxpbmctb24tcGFpbnRlZC1iYWNrZ3JvdW5kLmpwZWc_YmctcmVtb3ZlPXRydWU

Recommendations

  • Images with good lighting and high contrast between the foreground and background will work best with the background removal parameter.
  • Blurry or single-color backgrounds are preferred.
  • Blurry foregrounds may be removed, so it is best to use an image with a sharp foreground.
  • For product images, the whole product image should be visible in the frame.
  • The main subject should be in focus.
  • Avoid hard shadows and reflections.
  • Natural and eye-level angles are best.

See the API specification for more information about this parameter's value ranges and format.