# Photo QR code (halftone)

Turn a photo into a scannable QR code: the picture is dithered into the modules themselves, in color or mono.

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

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

- `text` (required, string): The text or link the code holds. Short links make finer pictures.
- `image` (required, file, a file reference such as `DROP_ID/f1`, accepts image): The photo to show in the code. Faces and bold shapes work best; it is cropped to a square.
- `error_correction` (optional, string, one of `L`, `M`, `Q`, `H`, default `"H"`): Error-correction level. H keeps the picture safest.
- `min_version` (optional, integer, range 1..25): Use at least this version: larger codes show more of the photo. Left out: 7 or the smallest that fits.
- `mode` (optional, string, one of `colour`, `mono`, default `"colour"`): "colour" keeps the photo's colors; mono draws it in two colors.
- `contrast` (optional, number, default `1.0`, range 0.5..2): Photo contrast, from 0.5 to 2.
- `brightness` (optional, number, default `0.0`, range -0.5..0.5): Photo brightness, from -0.5 to 0.5.
- `detail` (optional, string, one of `fine`, `balanced`, default `"balanced"`): fine fixes only the center of each module (more picture); balanced fixes five sub-pixels (sturdier). A fine code that does not read back is made again as balanced.
- `foreground` (optional, string, default `"#000000"`): Dark color (mono mode, and the corner eyes).
- `background` (optional, string, default `"#ffffff"`): Light color (mono mode, and the quiet zone).
- `margin` (optional, integer, default `4`, range 2..10): Quiet zone around the code, in modules.
- `size` (optional, integer, default `1200`, range 256..4000): Approximate width of the picture in pixels.
- `verify` (optional, boolean, default `true`): Read the code back with a decoder before returning it.

## Example 1: A color photo code

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":{"text":"https://setget.net","image":"DROP_ID/f1"},"wait":30}
```

## Example 2: Mono, finer detail

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":{"text":"https://setget.net","image":"DROP_ID/f1","mode":"mono","detail":"fine"},"wait":30}
```

**Will it really scan?** Every module keeps its center (and in balanced mode its middle cross) in the right color, which is what scanners read. Each result is read back by a decoder and says whether it passed. Test it with your phone before printing.

**Which photos work best?** Faces, logos and bold shapes with good contrast. Busy, low-contrast photos come out as noise. Try the contrast and brightness inputs.

**Why is the code bigger than usual?** More modules show more of the picture, so photo codes use at least version 7 (45 x 45 modules).
