xtract.bot
POST /api/image-jpeg-to-webp

Convert JPEGs to WebP — perceptually similar at 25–35% smaller files. Configurable quality, optional lossless mode for a perfect round-trip from decoded pixels.

Re-encodes a JPEG as WebP. WebP at quality 75 is roughly the perceptual equivalent of JPEG quality 85 at noticeably smaller files — useful for serving the same image to web clients that support WebP. Set `lossless: true` for a perfect round-trip from the decoded JPEG pixels (the JPEG itself is still lossy upstream, but no further loss is added).

Inputs

NameTypeDefaultDescription
image*fileJPEG bytes.
qualitynumber (1…100)75WebP quality 1–100. Default 75.
losslessbooleanfalseLossless 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"'"
}'