Background processing
Background of the image can be removed with "remove" parameter of background options.
"background": {
"remove": "auto",
"color": "#FFFFFF"
}
Description of "type" parameter of remove background function.
Parameter | Description |
---|---|
remove | Parameter that controls background removal algorithm.
|
color | Parameter that controls image background. If given, image alpha channel will be composited with it.
|
replace | URL for the background image replacement |
Let's check some examples.

Click on the result image to see the difference.
transparent
white
replace
"remove_background": {
"type": "auto",
"background": "transparent"
}
"remove_background": {
"type": "item",
"background": "#FFFFFF"
}

{
"url": "https://deep-image.ai/api-example.png",
"background": {
"remove": "auto",
"replace": "https://images.pexels.com/photos/628281/pexels-photo-628281.jpeg?auto=compress&cs=tinysrgb&w=1260&h=750&dpr=1"
}
}


Let's combine background removal, padding and cropping. With those combinations we are able to put object with any proportions in a desired canvas frame at the center with distance specified as padding option.
{
"url": "https://deep-image.ai/api-example2.jpg",
"width": 1000,
"height": 1000,
"fit": {
"crop": "item"
},
"background": {
"remove": "auto",
"color": "#FFFFFF"
},
"padding": 100
}

Result