JPEG → WebP
Try it interactively →POST /api/image-jpeg-to-webpConvert JPEGs to WebP — perceptually similar at 25–35% smaller files. Configurable quality, optional lossless mode for a perfect round-trip from decoded pixels.
Inputs
| Name | Type | Default | Description |
|---|---|---|---|
| image* | file | — | JPEG bytes. |
| quality | number (1…100) | 75 | WebP quality 1–100. Default 75. |
| lossless | boolean | false | Lossless WebP encode. Slower and larger. |
Response
Modes: binary, json. Cache: yes (24h TTL).
Code samples
Built from the thumbnail 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/image-jpeg-to-webp \
-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 '{
"quality": 75,
"image": "'"$IMAGE"'"
}'