# Reframe

For AI agents: this is the Markdown version of https://docs.fashiolabs.com/tools/photo_reframe.html. The index of all Fashio API docs is at https://docs.fashiolabs.com/llms.txt, and the complete reference in one file is at https://docs.fashiolabs.com/llms-full.txt.

Extends or re-crops an existing photo to a new aspect ratio — e.g. turning a square product shot into a 9:16 story crop or 16:9 banner — filling in new canvas content around the original subject rather than stretching or letterboxing it.

`toolId: "photo_reframe"` · 2 credits · deterministic · targetRatio (default 1:1)

![Reframe result — photo extended to a new aspect ratio](https://fashiolabs.com/images/photo-reframe/fashion-reframe-1-1.png)

## What it does

Reframe changes the canvas, not the subject: it fills in new content around the original photo so it fits a different aspect ratio, instead of stretching or letterboxing the existing pixels. Setting the target ratio is the entire purpose of this tool.

> This tool uses a different field name than every other tool: `targetRatio`, not `ratio`. Sending `ratio` here by habit is silently ignored — the request will succeed but default to `1:1` instead of the ratio you meant to request.

## Request body

| Field | Type |  | Description |
| --- | --- | --- | --- |
| `toolId` | string | required | Always `"photo_reframe"`. |
| `images.user_photo` | string | required | URL of the source photo to reframe (from `POST /v1/uploads` or your own hosting). |
| `targetRatio` | string | optional | One of `1:1`, `4:5`, `3:4`, `9:16`, `16:9`. Defaults to `1:1` — but set it, since it's the whole point of this tool. |

## Example request

**cURL**

```bash
curl -X POST https://api.fashiolabs.com/v1/generations \
  -H "Authorization: Bearer fio_live_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "toolId": "photo_reframe",
    "images": {
      "user_photo": "https://your-cdn.com/photo.jpg"
    },
    "targetRatio": "9:16"
  }'
```

**Node.js**

```javascript
const res = await fetch("https://api.fashiolabs.com/v1/generations", {
  method: "POST",
  headers: {
    Authorization: "Bearer " + process.env.FASHIO_API_KEY,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    toolId: "photo_reframe",
    images: {
      user_photo: "https://your-cdn.com/photo.jpg",
    },
    targetRatio: "9:16",
  }),
});
const { id } = await res.json();
```

**Python**

```python
import os, requests

res = requests.post(
    "https://api.fashiolabs.com/v1/generations",
    headers={"Authorization": f"Bearer {os.environ['FASHIO_API_KEY']}"},
    json={
        "toolId": "photo_reframe",
        "images": {
            "user_photo": "https://your-cdn.com/photo.jpg",
        },
        "targetRatio": "9:16",
    },
)
job_id = res.json()["id"]
```

## Response

**202 Accepted**

```json
{ "success": true, "id": "8b1e...", "status": "processing" }
```

Poll `GET /v1/generations/:id` (see [Quickstart](https://docs.fashiolabs.com/quickstart.md)) until it completes:

**200 · completed**

```json
{
  "success": true,
  "id": "8b1e...",
  "status": "completed",
  "resultUrls": ["https://.../result.jpg"],
  "errorMessage": null
}
```

## Common errors

| Status | Meaning |
| --- | --- |
| 400 | `photo_reframe: missing required image "user_photo"` — required image field wasn't resolvable. |
| 402 | `Insufficient diamonds. Required 2, have <n>.` |
| 429 | Daily request cap reached for this key — see [Rate Limits](https://docs.fashiolabs.com/rate-limits.md). |

## Related tools

- [Remove Background](https://docs.fashiolabs.com/tools/remove_background.md) — another deterministic, no-prompt pass on an existing photo.
- [Enhance / Upscale](https://docs.fashiolabs.com/tools/photo_enhance.md) — resolution/clarity pass instead of a canvas change.

---

Source: https://docs.fashiolabs.com/tools/photo_reframe.html · OpenAPI spec: https://docs.fashiolabs.com/openapi.yaml · Docs index: https://docs.fashiolabs.com/llms.txt
