Remove background
Turn one image into a cutout with a transparent background. No model or prompt to choose.
POST /image/remove-background takes one image URL and returns a cutout with
a transparent background. There is no model field and no prompt. Mynth picks
the model and keeps it current.
import Mynth from "@mynthio/sdk";
const mynth = new Mynth();
const cutout = await mynth.image.removeBackground({
url: "https://cdn.example.com/product.jpg",
output: { format: "png" },
});
console.log(cutout.image.url);Fields#
| Field | Notes |
|---|---|
url | Required. A public http(s) image URL |
output.format | png or webp. Both keep transparency. Omit it for the provider's format |
destination | A destination name. See destinations |
webhook | Per-request URLs. See webhooks |
metadata | A JSON object up to 2048 bytes |
access | { "pat": { "enabled": false } } skips the browser token |
For a local file, pass file instead of url in the SDK, or a path in the
CLI. Both upload it first.
What comes back#
{
"image": {
"id": "img_Q8mZr2LkT0vWc5NhY7pD3xFa9GsJ1bEu",
"url": "https://cdn.mynth.io/images/img_Q8mZr2LkT0vWc5NhY7pD3xFa9GsJ1bEu.png",
"mynth_url": "https://cdn.mynth.io/images/img_Q8mZr2LkT0vWc5NhY7pD3xFa9GsJ1bEu.png",
"size": "1024x1024",
"format": "png"
}
}There is one image and no per-item status. If the work fails, the task is
failed. With a destination, image also carries a destination block that
says whether the upload worked. See
destinations.
The create response includes a pat_ token, so a browser can poll this task
the same way it polls a generation. See
poll for results.
Price#
$0.02 per image, held at create and charged when the task succeeds. See pricing.
Next steps#
- Destinations: write the cutout to your own storage.
- Image to image: edits that need a prompt.