# Sprite sheet maker

Pack up to 64 images into one sprite sheet, with the position of every image and ready-to-paste CSS.

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

## 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

- `images` (required, files, a list of file references such as `["DROP_ID/f1"]`, at most 64, accepts image): The images to pack, up to 64.
- `layout` (optional, string, one of `shelf`, `grid`, default `"shelf"`): shelf packs images tightly in rows, tallest first. grid gives every image a cell of the same size, in upload order.
- `padding` (optional, integer, default `2`, range 0..64): Empty pixels between images and around the edge.
- `max_width` (optional, integer, default `0`, range 0..16000): Widest the sheet may be in pixels, for the shelf layout. 0 picks a roughly square sheet.
- `class_prefix` (optional, string, default `"sprite"`): Start of the CSS class names, for example sprite gives .sprite-NAME.
- `format` (optional, string, one of `png`, `webp`, default `"png"`): File format of the sheet.

## Example 1: Pack three images

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

```json
{"input":{"images":["DROP_1/f1","DROP_2/f1","DROP_3/f1"]},"wait":30}
```

## Example 2: Even grid without padding

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

```json
{"input":{"images":["DROP_1/f1","DROP_2/f1"],"layout":"grid","padding":0},"wait":30}
```

**How do I use the CSS?** Save the sheet next to your stylesheet, paste the CSS, then give an element the base class and one image class, for example class="sprite sprite-logo".

**What are the frame names?** The file name of each image without its extension, in lower case with other characters turned into dashes. Two files with the same name get -2, -3 and so on.

**Does the padding matter?** A pixel or two of padding stops neighbouring images from bleeding into each other when the sheet is scaled.
