# Convert image format

Convert an image between PNG, JPG, WebP, AVIF, GIF, BMP, TIFF and ICO. Animated GIF and WebP stay animated.

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

## 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 convert.
- `format` (required, string, one of `png`, `jpg`, `webp`, `avif`, `gif`, `bmp`, `tiff`, `ico`): The format to convert to.
- `quality` (optional, integer, range 1..100): Quality from 1 (smallest file) to 100 (best) for JPG, WebP and AVIF. Leave empty for a sensible default.
- `lossless` (optional, boolean, default `false`): Keep every pixel exact in WebP or AVIF, at the cost of a larger file.
- `background` (optional, string, default `"#ffffff"`): Colour put behind transparent areas when the new format has no transparency (JPG and BMP). A hex colour such as #ff8800, or a name such as white or black.

## Example 1: PNG to WebP

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","format":"webp"},"wait":30}
```

## Example 2: Transparent PNG to JPG on white

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

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

## Example 3: Animated GIF to animated WebP

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

```json
{"input":{"image":"DROP_ID/f1","format":"webp"},"wait":30}
```

**What happens to transparency?** PNG, WebP, AVIF, GIF, TIFF and ICO keep it. JPG and BMP cannot store it, so transparent areas are filled with the background colour, white unless you choose another.

**Do animations survive?** Yes when the new format can hold one: GIF, WebP, PNG (as APNG) and AVIF. Other formats get the first frame, and the result says so.

**How is an ICO made?** The image is fitted into a transparent square of at most 256 pixels and saved with the standard icon sizes up to that size.

**Is camera data kept?** No. Camera details and location are dropped. The colour profile is kept, and a photo that was stored sideways is turned upright.
