Media Utilities API
Remove Background
Remove the background from an image.
POST
/
background-removal
Body
application/json
init_image
string | null
Image to modify.
init_image_url
string | null
If given, download init_image from this URL.
output_image_encoding
any
Define which encoding process should be applied before returning the modified image. Only png is accepted.
alpha_matting
boolean | null
Flag indicating whether to use alpha matting.
alpha_matting_foreground_threshold
integer | null
Foreground threshold for alpha matting.
alpha_matting_background_threshold
integer | null
Background threshold for alpha matting.
alpha_matting_erode_size
integer | null
Erosion size for alpha matting.
only_mask
boolean | null
Flag indicating whether to return only the binary masks.
post_process_mask
boolean | null
Flag indicating whether to post-process the masks.
bgcolor
any[] | null
Background color for the cutout image.
Response
200 - application/json
image_b64
string | null
requiredThe modified image or None if it was removed for safety.
removed_for_safety
boolean
requiredTrue if the image was removed for safety, False otherwise.