---
title: "file.exportImage: Export Image — Layout kit command — Kition"
description: "Exports pages (default all) as PNG or JPEG images at a resolution, to a folder or as base64."
canonical: "https://developer.kition.ai/docs/kits/layout/commands/file.exportImage"
---

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

# file.exportImage

**Export Image.** Exports pages (default all) as PNG or JPEG images at a resolution, to a folder or as base64.

- Kit: Layout 0.1.0 (.klayout); reference: [Layout kit commands](https://developer.kition.ai/docs/kits/layout.md)
- Changes the document: yes

## Parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `background` | `"paper" \| "transparent"` | no | PNG only; default paper |
| `bleed` | `boolean` | no |  |
| `format` | `"png" \| "jpeg"` | no | default png |
| `pages` | `string \| integer[]` | no |  |
| `ppi` | `integer` | no | pixels per inch: 72 = one pixel per point |
| `quality` | `integer` | no | 1 to 100; JPEG, default 90 |
| `sizes` | `boolean` | no | every size: the first page of the original and of each alternate layout, instead of `pages` |
| `story` | `integer` | no | read by the command beside its listed parameters |

## Call through layout_run

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

The required parameters, with placeholders for their types: not a tested example. Optional: `background`, `bleed`, `format`, `pages`, `ppi`, `quality`, `sizes`, `story`. layout_run answers the step’s result in `completed[i].result`.

## Result

The kit gives no result schema for this command.

## Parameter schema

```json
{
  "additionalProperties": false,
  "properties": {
    "background": {
      "description": "PNG only; default paper",
      "enum": [
        "paper",
        "transparent"
      ],
      "type": "string"
    },
    "bleed": {
      "type": "boolean"
    },
    "format": {
      "description": "default png",
      "enum": [
        "png",
        "jpeg"
      ],
      "type": "string"
    },
    "pages": {
      "oneOf": [
        {
          "description": "page ranges such as 1-3,5 (1-based)",
          "type": "string"
        },
        {
          "description": "pages counted from 1",
          "items": {
            "type": "integer"
          },
          "type": "array"
        }
      ]
    },
    "ppi": {
      "default": 72,
      "description": "pixels per inch: 72 = one pixel per point",
      "type": "integer"
    },
    "quality": {
      "description": "1 to 100; JPEG, default 90",
      "type": "integer"
    },
    "sizes": {
      "description": "every size: the first page of the original and of each alternate layout, instead of `pages`",
      "type": "boolean"
    },
    "story": {
      "description": "read by the command beside its listed parameters",
      "type": "integer",
      "x-khp-types": [
        "Story"
      ]
    }
  },
  "returns": "{format, files: [{page, layout (its alternate layout's name, null in the original), base64, width, height}]}",
  "type": "object"
}
```

Generated from the command list of @kition/layout-darwin-arm64@0.1.0 and the kit itself (layout_commands through @kition/cli@0.1.1, built from KitionAI/kition-layout@8767a18).
