Resize PNG
Try it interactively →POST /api/image-resize-pngResize a PNG to specified dimensions. Pass only one dimension to preserve aspect ratio. Lossless re-encode.
Inputs
| Name | Type | Default | Description |
|---|---|---|---|
| image* | file | — | PNG 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. |
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"'"
}'