JPEG → AVIF
Try it interactively →POST /api/jpeg-to-avifConvert JPEG to AVIF — typically 30–50% smaller at the same perceptual quality. Configurable quality / encoder effort tradeoff.
Inputs
| Name | Type | Default | Description |
|---|---|---|---|
| image* | file | — | Input JPEG bytes. |
| quality | number (0…100) | 50 | AVIF visual quality 0–100 (50 ≈ JPEG q80). Ignored when lossless=true. |
| effort | number (0…10) | 4 | Encoder effort 0–10. Higher = smaller file, more CPU. |
| lossless | boolean | false | When true, encode losslessly from the decoded JPEG pixels. `quality` is ignored. The source JPEG was already lossy upstream, so this preserves the decode but doesn't recover the original capture. |
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-resize-jpeg/sample.jpg
IMAGE=$(base64 -w0 < sample.jpg)
curl -X POST https://api.xtract.bot/api/jpeg-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"'"
}'