Cutout removes the background from a photo and returns a transparent PNG of the subject: products, people, pets, cars. Ask for format: "mask" to get the black-and-white mask instead and composite it yourself.
Use it
curl https://labs.greatwork.company/v1/run \
-H "Authorization: Bearer $GWL_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "cutout-1",
"input": "https://labs.greatwork.company/examples/product.jpg"
}'const res = await fetch("https://labs.greatwork.company/v1/run", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.GWL_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
"model": "cutout-1",
"input": "https://labs.greatwork.company/examples/product.jpg"
}),
});
const { output, usage } = await res.json();import os, requests
res = requests.post(
"https://labs.greatwork.company/v1/run",
headers={"Authorization": f"Bearer {os.environ['GWL_API_KEY']}"},
json={
"model": "cutout-1",
"input": "https://labs.greatwork.company/examples/product.jpg"
},
)
output = res.json()["output"]# Send a local file instead of a URL
curl https://labs.greatwork.company/v1/run \
-H "Authorization: Bearer $GWL_API_KEY" \
-F model=cutout-1 \
-F input=@photo.jpgSet GWL_API_KEY to a key from your dashboard. The bare name cutout works too and follows new versions.
Options
input: An image: an https URL, a data URL (`data:image/png;base64,...`), or a file in a multipart upload. JPEG, PNG, WebP, GIF, AVIF or TIFF, up to 10 MB.
| Name | Type | Default | What it does |
|---|---|---|---|
format | string png | mask | "png" | png for the cutout with transparency, mask for the alpha mask. |
Output
| Field | Type | Meaning |
|---|---|---|
image | string | PNG as a data URL. |
foreground | number | Share of the image kept, 0 to 1. |
width | integer | Output width (long side up to 2,048 px). |
height | integer | Output height. |
Every response wraps this in {"id", "model", "output", "usage": {"units", "unit", "cost_usd"}, "latency_ms"}.
Examples
Product
{
"model": "cutout-1",
"input": "/examples/product.jpg"
}{
"image": "/examples/out/cutout-1-0.png",
"format": "png",
"width": 1024,
"height": 1024,
"foreground": 0.146
}Captured on our production servers: 5062 ms, 1 image, $0.002.
Good for
- Product photos on white or transparent
- Profile pictures and stickers
- Thumbnails with the subject cut out
- Masks for image editing
Limits and caveats
- Hair and fur edges are soft, not strand-perfect.
- Busy scenes with several subjects may keep more than you want.
- Takes a few seconds per image.
Pricing
$2.00 per 1,000 images. One unit per image. Failed calls aren't charged, and a call never costs more than its estimate (POST /v1/estimate tells you before you run it).
Built on
DIS ISNet general-use (xuebinqin/DIS), 44M parameters. License: Apache-2.0 (ONNX export by img.ly, MIT). We run it on our servers.