xtract.bot
POST /api/image-resize-webp

Resize a WebP to specified dimensions. Pass only one dimension to preserve aspect ratio. Configurable quality, optional lossless mode.

Resizes a WebP to the requested `width` × `height`. Pass one as `0` to derive it from the source aspect ratio. Output is WebP, with configurable quality (default 75). Set `lossless: true` for a perfect re-encode of the resized pixels.

Inputs

NameTypeDefaultDescription
image*fileWebP image bytes.
widthnumber (1…8192)Target width in pixels. Omit to derive from height × source aspect ratio.
heightnumber (1…8192)Target height in pixels. Omit to derive from width × source aspect ratio.
qualitynumber (1…100)75WebP encoder quality (0–100). Ignored when lossless=true.
losslessbooleanfalseEncode losslessly (slower, larger; ignores quality).

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-webp/sample.webp
IMAGE=$(base64 -w0 < sample.webp)

curl -X POST https://api.xtract.bot/api/image-resize-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 '{
  "width": 16,
  "height": 16,
  "quality": 80,
  "image": "'"$IMAGE"'"
}'