
Photo Rotator API
Design
Rotate a photo to any angle right in your browser. Crop back to the original size, or expand the canvas and fill the corners. Nothing is uploaded unless you use AI fill.
Authentication
All API requests require a valid API key passed in the Authorization header as a Bearer token.
Rate Limit
20 requests per minute
Endpoints
1 endpoint available
Overview
Rotate a photo to any angle and frame it, the same way the web page does. Send the image as multipart form
data in the file field. The response body is a PNG.
Modes
crop(default): the output is the photo's size, or the largest box ofaspectthat fits it. The rotated photo is scaled up just enough to cover it, so there are no empty corners.expand: the output grows to hold the whole rotated photo (widened toaspectif set), and the space around it getsfill: a hex colour ortransparent.
Notes
- Accepted input: JPEG, PNG, WebP, GIF, AVIF, TIFF and SVG, up to 20 MB and 50 megapixels. BMP, ICO and HEIC files return 415. Animated GIFs use the first frame.
angleis in whole degrees, clockwise. The EXIF orientation is applied first.zoomis 1 to 4 in crop mode and 0.3 to 3 in expand mode; values outside the mode's range are clamped.panXandpanYmove the photo from the centre, in output pixels, and are clamped like the page's drag (crop mode never shows a gap).- The output can be at most 10000 pixels per side.
- The page's AI fill is not available through the API.
Endpoints
POST
https://opentools.ca/api/v1/tools/photo-rotatorRotate a photo to any angle and frame it
Request Body
Content-Type: multipart/form-data
| Parameter | Type | Required | Description |
|---|---|---|---|
| file | file | Required | The image, up to 20 MB and 50 megapixels. JPEG, PNG, WebP, GIF (first frame), AVIF, TIFF or SVG. |
| angle | number | Optional | Rotation in whole degrees, clockwise, -360 to 360.Default: 0 |
| mode | string Enum: crop, expand | Optional | crop fills the frame; expand pads around the rotated photo.Default: crop |
| aspect | string Enum: original, 1:1, 4:3, 3:4, 16:9, 9:16 | Optional | Output ratio.Default: original |
| zoom | number | Optional | Scale: 1 to 4 in crop mode, 0.3 to 3 in expand mode.Default: 1 |
| panX | number | Optional | Horizontal offset of the photo in output pixels (positive moves it right).Default: 0 |
| panY | number | Optional | Vertical offset of the photo in output pixels (positive moves it down).Default: 0 |
| fill | string | Optional | Padding for expand mode: a hex colour (#rrggbb) or "transparent".Default: #000000 |
Response Example
HTTP/1.1 200 OK
Content-Type: image/png
Content-Disposition: attachment; filename="photo-rotated.png"
<binary file data>Error Codes
400
Bad Request - Missing file, invalid option, or output over 10000 pixels per side401
Unauthorized - Invalid or missing API key403
Forbidden - API key is inactive or expired, or the request IP is not allowed413
Payload Too Large - File over 20 MB or image over 50 megapixels415
Unsupported Media Type - Not an image the server can read (BMP, ICO and HEIC are not supported)429
Too Many Requests - Rate limit exceeded500
Internal Server ErrorCode Examples
# Straighten a horizon by 3 degrees, cropping the corners
curl -X POST https://opentools.ca/api/v1/tools/photo-rotator \
-H "Authorization: Bearer YOUR_API_KEY" \
-F "file=@beach.jpg" \
-F "angle=-3" \
-o beach-rotated.png
# Turn 45 degrees on a transparent square
curl -X POST https://opentools.ca/api/v1/tools/photo-rotator \
-H "Authorization: Bearer YOUR_API_KEY" \
-F "file=@logo.png" \
-F "angle=45" -F "mode=expand" -F "aspect=1:1" -F "fill=transparent" \
-o logo-rotated.pngRather use it in your browser? Open the Photo Rotator