# Turn an image into a sketch

> Turn a garment image into a technical drawing, in the style you choose, as line art or in colour. Delivered as one image file.

**Endpoint:** `POST https://api.refabric.com/v1/tasks/image.to_sketch` · **Task:** `image.to_sketch` · **Scope:** `tasks:run` · **Category:** Image editing

Send a garment image and get a technical drawing of it. Choose how it is drawn with `style`, and whether it is drawn in the garment's colours with `coloured`. Add notes in `prompt` to name construction details to keep or things to leave out.

## Quick start

```python
import os
import time
import requests

headers = {"Authorization": f"Key {os.environ['REFABRIC_API_KEY']}"}

job = requests.post(
    "https://api.refabric.com/v1/tasks/image.to_sketch",
    headers=headers,
    json={
        "image": "art:4b7e01",
    },
).json()
print(job["job_id"])

while True:
    status = requests.get(job["status_url"], headers=headers).json()
    if status["lifecycle"] == "terminal":
        break
    time.sleep(5)

print(requests.get(job["result_url"], headers=headers).json())
```

```javascript
const headers = {
  Authorization: `Key ${process.env.REFABRIC_API_KEY}`,
  "Content-Type": "application/json",
};

const job = await fetch("https://api.refabric.com/v1/tasks/image.to_sketch", {
  method: "POST",
  headers,
  body: JSON.stringify({
    "image": "art:4b7e01"
  }),
}).then((r) => r.json());
console.log(job.job_id);

let status = job;
while (status.lifecycle !== "terminal") {
  await new Promise((r) => setTimeout(r, 5000));
  status = await fetch(job.status_url, { headers }).then((r) => r.json());
}

console.log(await fetch(job.result_url, { headers }).then((r) => r.json()));
```

```bash
curl -X POST "https://api.refabric.com/v1/tasks/image.to_sketch" \
  -H "Authorization: Key $REFABRIC_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Prefer: wait=60" \
  -d '{"image":"art:4b7e01"}'
```

## Input schema

- `image` (string, _required_, pattern: ^(https://|art:|file:).+$) — The garment image to draw, as one string: a URL, a file from an earlier result (`art:…` or its url) or an upload (`file:…`). If it is one of your files placed on a design, the drawing is filed there too.
  Example: `art:4b7e01`
- `style` (string, _optional_, default: `standard`) — How the drawing is rendered. `standard` is clean line art of the garment, the drawing most uses need; each other style says when to choose it.
  Values: `standard` (Clean line art of the garment.); `technical` (A flat technical drawing, drawn left-right symmetrical. When you need a flat, symmetrical drawing for production.); `no_print` (Line art without the garment's print. When the drawing should show the garment's shape without its print.); `textured` (Line art that shows the fabric's texture. When the drawing should show the fabric's texture.)
  Example: `technical`
- `coloured` (boolean, _optional_, default: `false`) — Draw in the garment's colours instead of plain line art. Independent of `style`. A technical drawing is plain line art unless you ask for colour; send `true` when the drawing should also show the garment's colours.
  Example: `false`
- `prompt` (string, _optional_, max length 2000) — Notes for the drawing, in any language, up to 2000 characters — construction details to keep, things to leave out. Optional.
  Example: `keep the princess seams and the welt pockets; leave out the logo`

## Required-fields example

```json
{
  "image": "art:4b7e01"
}
```

## Full example

```json
{
  "image": "art:4b7e01",
  "style": "technical",
  "coloured": false,
  "prompt": "keep the princess seams and the welt pockets; leave out the logo"
}
```

## Output schema

- `files` (array<object>, _optional_) — One `image/*` file: the technical drawing of the garment.

## Response example

```json
{
  "job_id": "7a1c2e3f00004000800000000000001a",
  "lifecycle": "queued",
  "status_url": "http://v3-api.refabric.com/v1/jobs/7a1c2e3f00004000800000000000001a",
  "result_url": "http://v3-api.refabric.com/v1/jobs/7a1c2e3f00004000800000000000001a/result",
  "cancel_url": "http://v3-api.refabric.com/v1/jobs/7a1c2e3f00004000800000000000001a/cancel"
}
```

## Result example

```json
{
  "job_id": "7a1c2e3f00004000800000000000001a",
  "files": [
    {
      "file": "art:4b7e02",
      "url": "https://files.example.com/image.to_sketch/1.png",
      "media_type": "image/png",
      "task": "image.to_sketch",
      "job_id": "7a1c2e3f00004000800000000000001a",
      "created_at": "2026-10-01T09:14:07Z"
    }
  ],
  "has_more": false
}
```

`style: technical` is a flat, left-right symmetrical drawing; leave `style` out for standard line art. The image belongs to a design, so the drawing is saved on that design too.

## Built for

- A tech pack drawing from a design image
- Line art for a production brief
- A flat drawing to turn into a vector file

## What you get

- One image: the technical drawing of the garment.

## Specs

- **Input formats:** Images, each one string: a URL, an upload (`file:…`) or a file from an earlier result (`art:…`). Upload types and sizes: `GET /v1/meta` `limits.upload`.
- **Input count:** `image`: one
- **Output format:** Files: each one line with its `url` and its `media_type`, in the job's result.
- **Outputs per job:** One image file per job.

## Errors

- `field_not_accepted`
- `invalid_request`
- `invalid_option`
- `not_found`
- `permission_denied`
- `insufficient_credits`
- `processing_failed`

## Related

- `image.generate` — It runs before: its result is this input.
- `image.to_svg` — It runs after: it takes this task's result.
- `image.rotate_views` — It does a neighbouring job.

## Good to know

- `prompt` is at most 2000 characters.

## For agents and code generation

- https://api.refabric.com/v1/tasks/image.to_sketch/llms.txt
- https://api.refabric.com/v1/tasks/image.to_sketch/openapi.json
- GET https://api.refabric.com/v1/tasks/image.to_sketch
