Layout kit command

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)
Changes the document
no

Parameters

Parameters of file.render
NameTypeRequiredDescription
maxSizeinteger (≥ 1, ≤ 4096)noat most this many pixels on the longer side
scalenumber (≤ 2)nodevice pixels per point, at most 2 (default 1)
slideinteger (≥ 0)noa page counted from 0, when there is no target
targetobjectnothe 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

Result of file.render
NameTypeRequiredDescription
heightintegernothe image's height in pixels
pngstringnothe PNG image, base64
widthintegernothe image's width in pixels
Result JSON Schema
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/[email protected] and the kit itself (layout_commands through @kition/[email protected], built from KitionAI/kition-layout@8767a18). As data: commands.jsonl.