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

Resize a PNG to specified dimensions. Pass only one dimension to preserve aspect ratio. Lossless re-encode.

Resizes a PNG to the requested `width` × `height`. Pass one as `0` to derive it from the source aspect ratio. Output is PNG (lossless). For a different output format see `image-resize`.

Inputs

NameTypeDefaultDescription
image*filePNG 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.

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

curl -X POST https://api.xtract.bot/api/image-resize-png \
  -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,
  "image": "'"$IMAGE"'"
}'