---
title: "file.render: Render Preview — Layout kit command — Kition"
description: "Renders a preview of the layout as a PNG, without changing it: the whole canvas, one page, one spread, or one object (a diagnostic's target); answers {png, width, height}."
canonical: "https://developer.kition.ai/docs/kits/layout/commands/file.render"
---

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

# file.render

**Render Preview.** Renders a preview of the layout as a PNG, without changing it: the whole canvas, one page, one spread, or one object (a diagnostic's target); answers {png, width, height}.

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

## Parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `maxSize` | `integer (≥ 1, ≤ 4096)` | no | at most this many pixels on the longer side |
| `scale` | `number (≤ 2)` | no | device pixels per point, at most 2 (default 1) |
| `slide` | `integer (≥ 0)` | no | a page counted from 0, when there is no target |
| `target` | `object` | no | the part to draw, as a diagnostic's target names it: an object ({path: "item:<id>"}, an id layout_inspect lists), a page ({page}, counted from 1) or a spread ({spread}, counted from 0); without it, the whole canvas |

## Call through layout_run

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

The required parameters, with placeholders for their types: not a tested example. Optional: `maxSize`, `scale`, `slide`, `target`. layout_run answers the step’s result in `completed[i].result`.

## Result

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `height` | `integer` | no | the image's height in pixels |
| `png` | `string` | no | the PNG image, base64 |
| `width` | `integer` | no | the image's width in pixels |

```json
{
  "additionalProperties": false,
  "properties": {
    "height": {
      "description": "the image's height in pixels",
      "type": "integer"
    },
    "png": {
      "description": "the PNG image, base64",
      "type": "string"
    },
    "width": {
      "description": "the image's width in pixels",
      "type": "integer"
    }
  },
  "type": "object"
}
```

## Parameter schema

```json
{
  "additionalProperties": false,
  "properties": {
    "maxSize": {
      "description": "at most this many pixels on the longer side",
      "maximum": 4096,
      "minimum": 1,
      "type": "integer"
    },
    "scale": {
      "description": "device pixels per point, at most 2 (default 1)",
      "exclusiveMinimum": 0,
      "maximum": 2,
      "type": "number"
    },
    "slide": {
      "description": "a page counted from 0, when there is no target",
      "minimum": 0,
      "type": "integer"
    },
    "target": {
      "additionalProperties": true,
      "description": "the part to draw, as a diagnostic's target names it: an object ({path: \"item:<id>\"}, an id layout_inspect lists), a page ({page}, counted from 1) or a spread ({spread}, counted from 0); without it, the whole canvas",
      "properties": {
        "page": {
          "description": "a page counted from 1",
          "minimum": 1,
          "type": "integer",
          "x-khp-role": "place"
        },
        "path": {
          "description": "item:<id>, the object to draw",
          "type": "string"
        },
        "spread": {
          "description": "a spread counted from 0",
          "minimum": 0,
          "type": "integer",
          "x-khp-role": "place"
        }
      },
      "type": "object"
    }
  },
  "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).
