Photo kit command

file.render

Render View

Draws an explicit view of the image as a PNG, without the editor's state: the composite, or only the given layers (even hidden), framed to a region; answers how its pixels map to image coordinates and what it drew. Changes nothing.

Kit
Photo 0.1.0 (PSD, PSB, or .kphoto)
Changes the document
no

Parameters

Parameters of file.render
NameTypeRequiredDescription
background"transparent" | "white" | "#rrggbb"no
coalescestringnoMerges consecutive edits with the same key into one undo step, as a slider drag or a typing session is one.
maxSizeintegerno1 to 4096
scaleintegerno0 to 2
targetobjectnoThe view: `layer` (an id, or "#n", the n-th of the top level from the top), `layers` (ids), or `objectId` (a layer id) to draw only those layers; `region` [x, y, width, height] in image pixels to frame it.

Call through photo_run

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

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

Result

Result of file.render
NameTypeRequiredDescription
backgroundstringno
drawnanyno
heightintegerno
mappingstringno
pngstringno
regioninteger[]no
scalenumber[]no
widthintegerno
Result JSON Schema
json
{
  "additionalProperties": true,
  "properties": {
    "background": {
      "type": "string"
    },
    "drawn": {},
    "height": {
      "type": "integer"
    },
    "mapping": {
      "type": "string"
    },
    "png": {
      "type": "string"
    },
    "region": {
      "items": {
        "type": "integer"
      },
      "type": "array"
    },
    "scale": {
      "items": {
        "type": "number"
      },
      "type": "array"
    },
    "width": {
      "type": "integer"
    }
  },
  "type": "object"
}

Parameter schema

json
{
  "additionalProperties": false,
  "properties": {
    "background": {
      "default": "transparent",
      "enum": [
        "transparent",
        "white",
        "#rrggbb"
      ],
      "type": "string"
    },
    "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"
    },
    "maxSize": {
      "default": 1024,
      "description": "1 to 4096",
      "type": "integer"
    },
    "scale": {
      "default": 1,
      "description": "0 to 2",
      "type": "integer"
    },
    "target": {
      "additionalProperties": false,
      "description": "The view: `layer` (an id, or \"#n\", the n-th of the top level from the top), `layers` (ids), or `objectId` (a layer id) to draw only those layers; `region` [x, y, width, height] in image pixels to frame it.",
      "properties": {
        "layer": {
          "description": "One layer, by id or \"#n\".",
          "oneOf": [
            {
              "type": "integer"
            },
            {
              "type": "string"
            }
          ],
          "x-khp-name": "name",
          "x-khp-role": "object",
          "x-khp-types": [
            "Layer"
          ]
        },
        "layers": {
          "description": "Layers, by id.",
          "items": {
            "oneOf": [
              {
                "type": "integer"
              },
              {
                "type": "string"
              }
            ]
          },
          "type": "array",
          "x-khp-name": "name",
          "x-khp-role": "object",
          "x-khp-types": [
            "Layer"
          ]
        },
        "objectId": {
          "description": "A layer's id.",
          "oneOf": [
            {
              "type": "integer"
            },
            {
              "type": "string"
            }
          ],
          "x-khp-name": "name",
          "x-khp-role": "object",
          "x-khp-types": [
            "Layer"
          ]
        },
        "region": {
          "description": "[x, y, width, height] in image pixels.",
          "items": {
            "type": "number"
          },
          "type": "array"
        }
      },
      "type": "object"
    }
  },
  "returns": "{png, width, height, scale, region, mapping, drawn}",
  "type": "object"
}

Generated from the command list of @kition/[email protected] and the kit itself (photo_commands through @kition/[email protected], built from KitionAI/kition-photo@abe3f30). As data: commands.jsonl.