remove_background
Remove image backgrounds by providing a URL or base64-encoded image. Get a transparency-ready result, with optional resizing, cropping, and format selection.
Instructions
Remove the background from an image. Returns the processed image as base64. Accepts URL or base64-encoded image. Can also resize the result to an exact width x height without stretching (width, height, fit).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| fit | No | How to fit the image into width x height. 'contain' pads the remaining area (transparent or bg_color), 'cover' fills the canvas and crops the overflow around the subject, 'scale-down' is like contain but never enlarges a smaller image | contain |
| crop | No | Whether to crop the image to the subject bounds | |
| size | No | Output image size preset (megapixel cap). Ignored when width or height is set | full |
| image | Yes | Image input: base64-encoded image data or a URL to an image | |
| width | No | Output width in pixels. On its own, the height follows the aspect ratio. With height, the image is fitted into an exact width x height canvas without stretching | |
| format | No | Output image format | png |
| height | No | Output height in pixels. On its own, the width follows the aspect ratio. With width, the image is fitted into an exact width x height canvas without stretching | |
| bg_color | No | Background color (hex, rgb, or color name). Only applies when channels is 'rgb'. Example: '#ffffff' | |
| channels | No | Output color channels. Use 'rgba' for transparency, 'rgb' for opaque background | rgba |