# Rotate and flip image

Rotate an image by any angle and flip it horizontally or vertically. Quarter turns keep every pixel exact.

- Endpoint: `POST https://setget.net/v1/tools/image-rotate-flip` with JSON `{"input": {...}}` (add `"wait": 30` to hold the reply until the job finishes)
- MCP: `run_tool` with `slug` = `image-rotate-flip`
- Page: https://setget.net/tools/image-rotate-flip

## Files in, files out

This is a file tool. Its file inputs take file references, not file contents and not web addresses.

- Get a reference by uploading: `curl -T FILE https://setget.net/drop/` prints a line `ref  <id>/f1`. Or `POST https://setget.net/v1/drops` with `{"files":[{"name","size"}]}`, PUT the bytes to the returned `upload.url` with the listed headers, and use the file's `ref`. Over MCP use the `drop` tool. A file under about 700 KB can also be sent in place as a `data:<type>;base64,<content>` URI.
- Uploads are at most 100 MB per file, are readable by anyone with the link, and expire (one hour by default). Programs are refused.
- The tool runs as a job. The reply is `{"tool", "ms", "result", "files", "job"}`: `result` is JSON, and every result file comes back in `files` as `{"name", "size", "content_type", "kind", "url", "ref"}`. Download it from `url`, or pass `ref` as the input of another file tool.
- A job still running when the wait ends answers 202 with `job`. Follow it with `GET https://setget.net/v1/jobs/<id>?wait=30`, or stream progress from `GET https://setget.net/v1/jobs/<id>/events` (over MCP: the `job` tool). A person can watch it at `job.url`.

## Inputs

- `image` (required, file, a file reference such as `DROP_ID/f1`, accepts image): The image to rotate or flip.
- `angle` (optional, number, default `0`, range -3600..3600): Degrees to turn the image clockwise. Use a negative number to turn it anticlockwise.
- `flip` (optional, string, one of `none`, `horizontal`, `vertical`, default `"none"`): Mirror the image after rotating: horizontal swaps left and right, vertical swaps top and bottom.
- `background` (optional, string, default `"transparent"`): Colour for the empty corners left by a turn that is not a quarter turn. transparent becomes white in formats without transparency, such as JPG. A hex colour such as #ff8800, or a name such as white or black.
- `expand` (optional, boolean, default `true`): Grow the canvas so the whole turned image fits. Turn off to keep the original size and cut off the corners. Quarter turns always keep the whole image.

## Example 1: Quarter turn clockwise

Upload first. Each placeholder below stands for the reference of one upload: `DROP_ID/f1` = [sample.jpg](https://setget.net/static/samples/sample.jpg).

```json
{"input":{"image":"DROP_ID/f1","angle":90},"wait":30}
```

## Example 2: Mirror left to right

Upload first. Each placeholder below stands for the reference of one upload: `DROP_ID/f1` = [sample.png](https://setget.net/static/samples/sample.png).

```json
{"input":{"image":"DROP_ID/f1","flip":"horizontal"},"wait":30}
```

## Example 3: Tilt 15 degrees on white

Upload first. Each placeholder below stands for the reference of one upload: `DROP_ID/f1` = [sample.png](https://setget.net/static/samples/sample.png).

```json
{"input":{"image":"DROP_ID/f1","angle":15,"background":"#ffffff"},"wait":30}
```

**Which way is positive?** Clockwise. An angle of 90 turns the top of the image to the right; -90 turns it to the left.

**Why did my image get larger after rotating?** A tilted rectangle needs a bigger canvas to fit. Set expand to false to keep the original size instead; the corners are then cut off.

**My photo shows sideways in some apps. Will this fix it?** Yes. The photo is first turned the way the camera recorded it should be shown, then your rotation is applied, and the result displays the same everywhere.
