---
title: "file.exportImage: Export Image — Photo kit command — Kition"
description: "Answers the flattened document encoded as PNG, JPEG, TIFF or WebP (`format`; `quality`, WebP `lossless`, `width`/`height`, `transparency` and its `matte`) as base64 {data, mime, bytes, width, height}; writes no file."
canonical: "https://developer.kition.ai/docs/kits/photo/commands/file.exportImage"
---

> Canonical HTML: [https://developer.kition.ai/docs/kits/photo/commands/file.exportImage](https://developer.kition.ai/docs/kits/photo/commands/file.exportImage)

# file.exportImage

**Export Image.** Answers the flattened document encoded as PNG, JPEG, TIFF or WebP (`format`; `quality`, WebP `lossless`, `width`/`height`, `transparency` and its `matte`) as base64 {data, mime, bytes, width, height}; writes no file.

- Kit: Photo 0.1.0 (PSD, PSB, or .kphoto); reference: [Photo kit commands](https://developer.kition.ai/docs/kits/photo.md)
- Changes the document: no

## Parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `coalesce` | `string` | no | Merges consecutive edits with the same key into one undo step, as a slider drag or a typing session is one. |
| `format` | `"png" \| "jpg" \| "tiff" \| "webp"` | no |  |
| `height` | `number` | no | pixels; one side keeps the aspect ratio |
| `lossless` | `boolean` | no | WebP |
| `matte` | `string` | no | like #rrggbb |
| `quality` | `integer` | no | 1 to 100; JPEG, lossy WebP |
| `transparency` | `boolean` | no | off: flattened onto `matte` |
| `width` | `number` | no | pixels |

## Call through photo_run

```text
photo_run {
  "path": "<file>.psd",
  "steps": [{ "command": "file.exportImage" }]
}
```

The required parameters, with placeholders for their types: not a tested example. Optional: `coalesce`, `format`, `height`, `lossless`, `matte`, `quality`, `transparency`, `width`. photo_run answers the step’s result in `completed[i].result`.

## Result

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `bytes` | `integer` | no |  |
| `data` | `string` | no |  |
| `height` | `integer` | no |  |
| `mime` | `string` | no |  |
| `width` | `integer` | no |  |

```json
{
  "additionalProperties": true,
  "properties": {
    "bytes": {
      "type": "integer"
    },
    "data": {
      "type": "string"
    },
    "height": {
      "type": "integer"
    },
    "mime": {
      "type": "string"
    },
    "width": {
      "type": "integer"
    }
  },
  "type": "object"
}
```

## Parameter schema

```json
{
  "additionalProperties": false,
  "properties": {
    "coalesce": {
      "description": "Merges consecutive edits with the same key into one undo step, as a slider drag or a typing session is one.",
      "type": "string"
    },
    "format": {
      "default": "png",
      "enum": [
        "png",
        "jpg",
        "tiff",
        "webp"
      ],
      "type": "string"
    },
    "height": {
      "description": "pixels; one side keeps the aspect ratio",
      "type": "number"
    },
    "lossless": {
      "default": false,
      "description": "WebP",
      "type": "boolean"
    },
    "matte": {
      "default": "#ffffff",
      "description": "like #rrggbb",
      "type": "string"
    },
    "quality": {
      "description": "1 to 100; JPEG, lossy WebP",
      "type": "integer"
    },
    "transparency": {
      "default": true,
      "description": "off: flattened onto `matte`",
      "type": "boolean"
    },
    "width": {
      "description": "pixels",
      "type": "number"
    }
  },
  "returns": "{data: base64, mime, bytes, width, height}",
  "type": "object"
}
```

Generated from the command list of @kition/photo-darwin-arm64@0.1.0 and the kit itself (photo_commands through @kition/cli@0.1.1, built from KitionAI/kition-photo@abe3f30).
