---
name: "image_transform"
area: "images"
title: "Resize or convert an image"
price: "$0.005"
method: "POST"
url: "https://api.conecto.chat/v1/tools/image_transform"
mcp_server: "https://api.conecto.chat/mcp/images"
auth: "Authorization: Bearer <conecto_sk_ key>"
docs_url: "https://conecto.chat/tools/images/image_transform"
---

# Resize or convert an image (`image_transform`)

A new image from one in the store: resized or cropped, converted to WebP, AVIF, JPEG or PNG and compressed, with GPS data removed.

A new image from one in the file store: resized (fit inside the box, or cover it and crop the overflow from the center), converted to WebP, AVIF, JPEG or PNG, and compressed. Photos come out turned the right way up with their metadata (GPS included) removed.

Price: $0.005 a call. A call that fails costs nothing.

## Use it when

An image is too big, the wrong shape or the wrong format for where it goes.

## Say this to your agent

> Make the new Tabor photo a 1080 by 1080 square for Instagram.

## Inputs

| Name | Type | Required | Description | Allowed values | Default |
|---|---|---|---|---|---|
| `file_id` | string | yes | An image in the file store. Exactly 36 characters. |  |  |
| `width` | integer | no | 1 to 8,000. |  |  |
| `height` | integer | no | 1 to 8,000. |  |  |
| `fit` | string | no |  | `"inside"`, `"cover"` | `"inside"` |
| `format` | string | no |  | `"webp"`, `"avif"`, `"jpeg"`, `"png"` | `"webp"` |
| `quality` | integer | no | 30 to 100. |  | `82` |
| `name` | string | no | Up to 200 characters. |  |  |
| `link_hours` | integer | no | 1 to 168. |  |  |

## Example

Written for Halverson Cycle & Repair, a bike shop with a repair workshop in Portland, Oregon.

MCP: call `image_transform` on the MCP server `https://api.conecto.chat/mcp/images` with these arguments:

```json
{
  "file_id": "2c4e6a8c-0e2a-4c6e-9a0c-4e6a8c0e2a5c",
  "width": 1080,
  "height": 1080,
  "fit": "cover",
  "format": "jpeg",
  "name": "tabor-square.jpg"
}
```

REST:

```bash
curl https://api.conecto.chat/v1/tools/image_transform \
  -H "Authorization: Bearer $CONECTO_KEY" \
  -H "Content-Type: application/json" \
  -d '{"file_id": "2c4e6a8c-0e2a-4c6e-9a0c-4e6a8c0e2a5c", "width": 1080, "height": 1080, "fit": "cover", "format": "jpeg", "name": "tabor-square.jpg"}'
```

## Response

```json
{
  "call_id": "5f0c8a2e-3b7d-4c1e-9a64-2d8e1f7b0c93",
  "tool": "image_transform",
  "status": "succeeded",
  "replayed": false,
  "cost_usd": "$0.005",
  "balance_usd": "$19.75",
  "result": {
    "file": {
      "file_id": "d97c3603-2f05-4939-a121-0fbdae319fcc",
      "name": "tabor-square.jpeg",
      "content_type": "image/jpeg",
      "size": "7.1 KB",
      "size_bytes": 7222,
      "sha256": "e2560f4cc6a93a7e11984db87560dd635bbf7cefbc4b9bd3374fe82d700b4102",
      "created_at": "2026-10-14T08:00:00+00:00",
      "download_url": "https://cncto.co/d/d97c3603-2f05-4939-a121-0fbdae319fcc?t=eyJmIjoiZDk3YzM2MDMtMmYwNS00OTM5LWExMjEtMGZiZGFlMzE5ZmNjIiwiZXhwIjoxNzkyMTYwNDgzfQ:1xHMKh:WXQuFxfJ6cW11CA5UUuclMinHv6ZEt_qD-edjAJO3vk",
      "link_expires_in_hours": 24
    },
    "width": 1080,
    "height": 1080
  }
}
```

`result`: file: the new image with its file_id, name, size and download link; width and height.

## Errors

| Code | Status | When | Fix |
|---|---|---|---|
| `not_found` | 404 | No file in the store has that file_id. | Find it with files_list. |
| `not_image` | 400 | The file is not an image that can be read (PNG, JPEG, WebP, AVIF, GIF, BMP or TIFF). | Upload the image again in one of those formats. |
| `too_large` | 413 | The image is over 40 megapixels. | Ask for a smaller copy of it. |
| `invalid_input` | 400 | fit is cover without both width and height. | Send both, or fit: inside. |
| `storage_full` | 409 | The file store has no room for the new image. | Delete files with files_delete, or add room with files_add_storage. |

The refusals every tool can give (401 key, 402 balance, 429 limits) are on the errors page: https://conecto.chat/docs/errors.md

## Related

- [image_info](https://conecto.chat/tools/images/image_info.md): An image's width, height, format and size, and whether it has transparency. Free up to 1,000,000 reads a month.
