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

Resize a JPEG to specified dimensions. Pass only one dimension to preserve aspect ratio. Configurable quality on re-encode.

Resizes a JPEG to the requested `width` × `height`. Pass one of them as `0` (or omit) to derive that dimension from the source aspect ratio. Output is JPEG with configurable quality (default 80). For a different output format see `image-resize` (multi-format) or the format-specific resize tools.

Inputs

NameTypeDefaultDescription
image*fileJPEG 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)75JPEG encoder quality (0–100).

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-resize-jpeg \
  -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"'"
}'