Image Rotate
Rotate an image by any angle with configurable background fill
/v1/image/rotate
curl "https://image.toolkitapi.io/v1/image/rotate?url=https://toolkitapi.io/static/samples/sample-image.png°rees=45&expand=true&fill_color=%23ffffff"
import httpx
resp = httpx.get(
"https://image.toolkitapi.io/v1/image/rotate?url=https://toolkitapi.io/static/samples/sample-image.png°rees=45&expand=true&fill_color=%23ffffff",
)
print(resp.json())
const resp = await fetch("https://image.toolkitapi.io/v1/image/rotate?url=https://toolkitapi.io/static/samples/sample-image.png°rees=45&expand=true&fill_color=%23ffffff", {
});
const data = await resp.json();
console.log(data);
# See curl example
{
"image": "iVBORw0KGgoAAAANSUhEUg...(base64 data)...",
"format": "png",
"degrees": 45,
"size": {"width": 1494, "height": 1494}
}
Try It Live
Description
How to Use
1. Provide the source image via the `url` query parameter.
2. Set `degrees` for the rotation angle (clockwise positive, counter-clockwise negative).
3. Set `expand` to true (default) to grow the canvas, or false to keep original dimensions.
4. Choose a `fill_color` (hex) for any exposed background areas.
About This Tool
Use the Image Rotate endpoint to rotate an image by any angle (clockwise positive). The `expand` option controls whether the canvas grows to fit the rotated image or stays the same size with corners cropped. Exposed background areas are filled with a configurable colour.
This is useful for correcting tilted photos, creating artistic effects, and preparing images for specific layout requirements.
Why Use This Tool
- Photo straightening — Correct tilted horizon lines or skewed scans
- Artistic effects — Create dynamic angled compositions
- Document processing — Fix rotated scanned documents
- Orientation correction — Rotate images to the correct orientation
Frequently Asked Questions
How does expand work?
Can I rotate by fractional degrees?
What colour format does fill_color accept?
Start using Image Rotate now
Get your free API key and make your first request in under a minute.