Any image in, clean pixel art out. A faithful redraw: subject, composition, colours and proportions stay true to the input.
| Field | Type | Notes |
|---|---|---|
| image_b64 | string, required | Base64 (or data URL) PNG, JPG or WebP. Max 10MB decoded, 4096px per axis |
| remove_background | bool | Default true: transparent sprite. false: the redraw keeps the original background (opaque output) |
| height | int | 16 to 512, default 128. Output sprite height; width follows the source aspect |
| …plus any of the tuning parameters | ||
Python:
import base64, requests
img = base64.b64encode(open("product_photo.jpg", "rb").read()).decode()
r = requests.post(
"https://spritelab.dev/api/v1/convert",
headers={"Authorization": "Bearer sl_live_YOUR_KEY"},
json={"image_b64": img, "height": 96},
)
r.raise_for_status()
out = r.json()
open("pixel.png", "wb").write(base64.b64decode(out["image_b64"]))
print(out["width"], "x", out["height"], "| credits left:", out["credits_remaining"])
Response envelope:
{
"id": "a3f2…", # history row id, feed it to /resize
"mode": "convert",
"image_b64": "…",
"width": 96, "height": 96,
"cost": 3,
"credits_remaining": 377
}
The conversion itself costs 3 credits; everything after is free. Pass the returned id to POST /resize with new dimensions or tuning (palette lock, outline, colour count) and the pipeline re-runs against the saved conversion without another model call.