Resize JPEG
Try it interactively →POST /api/image-resize-jpegResize a JPEG to specified dimensions. Pass only one dimension to preserve aspect ratio. Configurable quality on re-encode.
Inputs
| Name | Type | Default | Description |
|---|---|---|---|
| image* | file | — | JPEG image bytes. |
| width | number (1…8192) | — | Target width in pixels. Omit to derive from height × source aspect ratio. |
| height | number (1…8192) | — | Target height in pixels. Omit to derive from width × source aspect ratio. |
| quality | number (1…100) | 75 | JPEG 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"'"
}'