Photo kit command

file.exportImage

Export Image

Answers the flattened document encoded as PNG, JPEG, TIFF or WebP (`format`; `quality`, WebP `lossless`, `width`/`height`, `transparency` and its `matte`) as base64 {data, mime, bytes, width, height}; writes no file.

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

Parameters

Parameters of file.exportImage
NameTypeRequiredDescription
coalescestringnoMerges consecutive edits with the same key into one undo step, as a slider drag or a typing session is one.
format"png" | "jpg" | "tiff" | "webp"no
heightnumbernopixels; one side keeps the aspect ratio
losslessbooleannoWebP
mattestringnolike #rrggbb
qualityintegerno1 to 100; JPEG, lossy WebP
transparencybooleannooff: flattened onto `matte`
widthnumbernopixels

Call through photo_run

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

The required parameters, with placeholders for their types: not a tested example. Optional: coalesce, format, height, lossless, matte, quality, transparency, width. photo_run answers the step’s result in completed[i].result.

Result

Result of file.exportImage
NameTypeRequiredDescription
bytesintegerno
datastringno
heightintegerno
mimestringno
widthintegerno
Result JSON Schema
json
{
  "additionalProperties": true,
  "properties": {
    "bytes": {
      "type": "integer"
    },
    "data": {
      "type": "string"
    },
    "height": {
      "type": "integer"
    },
    "mime": {
      "type": "string"
    },
    "width": {
      "type": "integer"
    }
  },
  "type": "object"
}

Parameter schema

json
{
  "additionalProperties": false,
  "properties": {
    "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"
    },
    "format": {
      "default": "png",
      "enum": [
        "png",
        "jpg",
        "tiff",
        "webp"
      ],
      "type": "string"
    },
    "height": {
      "description": "pixels; one side keeps the aspect ratio",
      "type": "number"
    },
    "lossless": {
      "default": false,
      "description": "WebP",
      "type": "boolean"
    },
    "matte": {
      "default": "#ffffff",
      "description": "like #rrggbb",
      "type": "string"
    },
    "quality": {
      "description": "1 to 100; JPEG, lossy WebP",
      "type": "integer"
    },
    "transparency": {
      "default": true,
      "description": "off: flattened onto `matte`",
      "type": "boolean"
    },
    "width": {
      "description": "pixels",
      "type": "number"
    }
  },
  "returns": "{data: base64, mime, bytes, width, height}",
  "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.