Layout kit command

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

Parameters

Parameters of file.exportImage
NameTypeRequiredDescription
background"paper" | "transparent"noPNG only; default paper
bleedbooleanno
format"png" | "jpeg"nodefault png
pagesstring | integer[]no
ppiintegernopixels per inch: 72 = one pixel per point
qualityintegerno1 to 100; JPEG, default 90
sizesbooleannoevery size: the first page of the original and of each alternate layout, instead of `pages`
storyintegernoread 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/[email protected] and the kit itself (layout_commands through @kition/[email protected], built from KitionAI/kition-layout@8767a18). As data: commands.jsonl.