Rotate image
Try it interactively →POST /api/image-rotateRotate an image by any angle (in degrees). Configurable background fill for the corners exposed by non-90° rotations.
Inputs
| Name | Type | Default | Description |
|---|---|---|---|
| image* | file | — | Input image (PNG / JPEG / WebP). |
| degrees* | number (-360…360) | — | Clockwise rotation angle in degrees. |
| bgColor | string | "white" | Fill colour for corner triangles on non-right-angle rotations (CSS-style names or #rrggbb). |
| format | enum (png | jpeg | webp) | — | Output format. Defaults to the input's format. |
Response
Modes: binary, base64-json. Cache: yes (24h TTL).
Code samples
Built from the rotate-90 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-rotate \
-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 '{
"degrees": 90,
"image": "'"$IMAGE"'"
}'