How to rotate or flip an image with an API

Updated 2026-11-10

Use when an image must be turned or flipped, for example to fix its orientation. Add output=url for a 24 h link.

From an MCP client, add https://tanod.dev/mcp and call image_rotate; its free daily calls are applied automatically, no key or signup.

POST an image URL to /v1/image/rotate with an angle and/or a flip. It returns the rotated image as base64.

Request

angle is clockwise degrees (default 0). flip is none, horizontal, vertical or both. For angles that are not multiples of 90, expand (default true) grows the canvas and background fills the corners. Input is a public image URL (up to 10 MB) or image_base64 (up to 10 MB decoded; a data:image/...;base64, prefix is fine).

curl, using the free tier
curl -s -X POST https://tanod.dev/v1/image/rotate \
  -H 'X-Tanod-Free: 1' -H 'content-type: application/json' \
  -d '{"url": "https://tanod.dev/icon.png", "angle": 90, "flip": "horizontal"}'

The file comes back as base64 in the JSON. To save it, pipe the response through jq and base64:

save the result to a file
curl -s -X POST https://tanod.dev/v1/image/rotate \
  -H 'X-Tanod-Free: 1' -H 'content-type: application/json' \
  -d '{"url": "https://tanod.dev/icon.png", "angle": 90, "flip": "horizontal"}' \
  | jq -r '.data_base64' | base64 -d > rotated.png

Response

Response (example from the API spec, trimmed)
{
  "operation": "rotate",
  "input": {
    "format": "png",
    "width": 256,
    "height": 256,
    "bytes": 2183,
    "frames": 1,
    "animated": false,
    "has_alpha": true
  },
  "source_url": "https://tanod.dev/icon.png",
  "final_url": "https://tanod.dev/icon.png",
  "format": "png",
  "content_type": "image/png",
  "bytes": 2821,
  "width": 256,
  "height": 256,
  "data_base64": "iVBORw0KGgoAAAAN",
  "angle": 90.0,
  "flip": "horizontal",
  "notes": [],
  "source": {
    "library": "Pillow",
    "license": "MIT-CMU (HPND)",
    "url": "https://python-pillow.org"
  }
}

Canvas size after rotating a 4000 × 3000 image

Angles are clockwise. flip is applied after the rotation, so 90 plus horizontal is a rotate-then-mirror.

Limits and caveats

Paying by card instead? The Apify actor Image Toolkit (tanod/image-toolkit) does the same at USD 0.005 per image plus Apify's start fee per run.

Lossless only at 90. Multiples of 90 degrees are lossless transposes. Other angles are resampled with bicubic interpolation, which softens edges slightly.

EXIF orientation first. With auto_orient (default true) the stored orientation is applied before your angle, so a rotated phone photo may already be upright.

Inputs and sizes. PNG, JPEG, WebP, GIF, TIFF, BMP, ICO or AVIF (first frame only); HEIC, SVG, PDF, PSD and EPS get a 422. Over 40 megapixels in (image_too_large) or 15 MB or 50 megapixels out (output_too_large) is a 413. Refusals are not charged. EXIF, GPS, XMP and IPTC metadata are not copied, images are not logged, and a result is kept (24 hours) only with output url.

Doing this by hand? Use the free image rotator in your browser.

Download link. Add "output": "url" to the request and the file is stored for 24 hours and returned as a link (url, expires_at, sha256) instead of base64, which keeps it out of your context window. The price is the same. How the links work.

Price and free allowance

USD 0.002 per call, paid in USDC on Base, Polygon, Solana, BNB Chain or Arbitrum with x402. 3 free calls per IP per UTC day with the header X-Tanod-Free: 1. The pool is shared by every image operation. MCP tool: image_rotate at https://tanod.dev/mcp, where the free tier is automatic.

All endpoints →

Use it from Claude without writing code: in claude.ai or Claude Desktop, add https://tanod.dev/mcp/images?via=image-rotate-api as a custom connector (steps), then ask in plain words, for example "Rotate this image 90 degrees clockwise." The free daily allowance is applied automatically over MCP. Beyond it a call needs an x402 payment, which these clients can make.

Related guides: How to crop an image to a box or an aspect ratio with an API, How to resize an image from a URL with an API, How to rotate the pages of a PDF with an API. Back to tanod.dev or the guide index. Results are automated and heuristic.