🔄

Image Rotate

Rotate an image by any angle with configurable background fill

GET 10 credits /v1/image/rotate
curl "https://image.toolkitapi.io/v1/image/rotate?url=https://toolkitapi.io/static/samples/sample-image.png&degrees=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&degrees=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&degrees=45&expand=true&fill_color=%23ffffff", {
});
const data = await resp.json();
console.log(data);
# See curl example
Response 200 OK
{
  "image": "iVBORw0KGgoAAAANSUhEUg...(base64 data)...",
  "format": "png",
  "degrees": 45,
  "size": {"width": 1494, "height": 1494}
}

Try It Live

Live Demo

Description

Rotate an image by any angle with configurable background fill

How to Use

1

1. Provide the source image via the `url` query parameter.

2

2. Set `degrees` for the rotation angle (clockwise positive, counter-clockwise negative).

3

3. Set `expand` to true (default) to grow the canvas, or false to keep original dimensions.

4

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

Frequently Asked Questions

How does expand work?
With `expand=true`, the canvas is enlarged so the entire rotated image is visible. With `expand=false`, the canvas stays at the original dimensions and corners of the rotated image are clipped.
Can I rotate by fractional degrees?
Yes, the `degrees` parameter accepts floating-point values like 2.5 or 0.7 for fine adjustments.
What colour format does fill_color accept?
Standard hex colours: 3-digit (#fff) or 6-digit (#ffffff) format.

Start using Image Rotate now

Get your free API key and make your first request in under a minute.