xtract.bot
POST /api/webp-to-avif

Convert WebP to AVIF — typically 20–30% smaller at the same perceptual quality. Configurable quality / encoder effort tradeoff.

Re-encodes a WebP as AVIF. AVIF is the most efficient modern image format — typically 20–30% smaller than WebP at visually equivalent quality, at the cost of slower encode. Quality is 1–100 (default 50). Higher quality preserves more detail but produces larger files. The encoder also exposes an `effort` tradeoff: higher numbers encode slower but produce smaller output. Note that the source WebP was already lossy (unless it was lossless WebP) — encoding to AVIF won't *recover* detail. Animated WebP inputs aren't supported here — only the first frame is converted.

Inputs

NameTypeDefaultDescription
image*fileInput WebP bytes.
qualitynumber (0…100)50AVIF visual quality 0–100 (50 ≈ JPEG q80). Ignored when lossless=true.
effortnumber (0…10)4Encoder effort 0–10. Higher = smaller file, more CPU.
losslessbooleanfalseWhen true, encode losslessly from the decoded WebP pixels. `quality` is ignored.

Response

Modes: binary, base64-json. Cache: yes (24h TTL).

Code samples

Built from the default example.

# Download or substitute the example input:
#   curl -O https://xtract.bot/examples/image-webp-to-png/sample.webp
IMAGE=$(base64 -w0 < sample.webp)

curl -X POST https://api.xtract.bot/api/webp-to-avif \
  -H "Content-Type: application/json" \
  -H "Accept: application/octet-stream" \
  -H "X-Account-Id: $XTRACT_ACCOUNT_ID" \
  -H "X-Api-Key: $XTRACT_API_KEY" \
  -d '{
  "image": "'"$IMAGE"'"
}'