Photo kit command

file.inspect

Inspect Document

Answers the active document (or `document`): size, mode, the layer tree with ids, kinds, names and properties, channels, paths, selection and history. Start here.

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

Parameters

Parameters of file.inspect
NameTypeRequiredDescription
coalescestringnoMerges consecutive edits with the same key into one undo step, as a slider drag or a typing session is one.
documentintegernoa position counted from 0 (the first is 0)
regionobjectnoWhere the command acts, for this call only: {"rect": [x, y, width, height]}, {"ellipse": [x, y, width, height]}, {"polygon": [[x, y], …]} (3 points or more), {"layer": id} (that layer's pixels, by their opacity), {"channel": name or index} (a saved selection or alpha channel), or "all"; add "invert": true to take everything else. Without it, inside the current selection (made with select.* earlier in the run), or everywhere when there is none.

Call through photo_run

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

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

Result

Result of file.inspect
NameTypeRequiredDescription
activeLayerintegerno
canRedobooleanno
canUndobooleanno
channelsobjectno
depthintegerno
effectsCollapsedany[]no
hasSelectionbooleanno
heightintegerno
historystring[]no
historyIndexintegerno
historyRedoany[]no
isolatedLayersany[]no
lastAppliedCompanyno
layerCompsany[]no
layerMaskViewanyno
layersobject[]no
measurementobjectno
modestringno
namestringno
notesany[]no
quickMaskbooleanno
resolutionnumberno
revisionintegerno
selectedLayersinteger[]no
selectionBoundsanyno
symmetryanyno
timelineanyno
variablesanyno
widthintegerno
Result JSON Schema
json
{
  "additionalProperties": true,
  "properties": {
    "activeLayer": {
      "type": "integer"
    },
    "canRedo": {
      "type": "boolean"
    },
    "canUndo": {
      "type": "boolean"
    },
    "channels": {
      "additionalProperties": true,
      "properties": {
        "alpha": {
          "type": "array"
        },
        "colors": {
          "items": {},
          "type": "array"
        },
        "composite": {
          "type": "string"
        },
        "compositeVisible": {
          "type": "boolean"
        },
        "layerMaskView": {},
        "quickMask": {},
        "target": {
          "additionalProperties": true,
          "properties": {
            "kind": {
              "type": "string"
            }
          },
          "type": "object"
        }
      },
      "type": "object"
    },
    "depth": {
      "type": "integer"
    },
    "effectsCollapsed": {
      "type": "array"
    },
    "hasSelection": {
      "type": "boolean"
    },
    "height": {
      "type": "integer"
    },
    "history": {
      "items": {
        "type": "string"
      },
      "type": "array"
    },
    "historyIndex": {
      "type": "integer"
    },
    "historyRedo": {
      "type": "array"
    },
    "isolatedLayers": {
      "type": "array"
    },
    "lastAppliedComp": {},
    "layerComps": {
      "type": "array"
    },
    "layerMaskView": {},
    "layers": {
      "items": {
        "additionalProperties": true,
        "properties": {
          "blend": {
            "type": "string"
          },
          "bounds": {},
          "clipped": {
            "type": "boolean"
          },
          "fill": {
            "type": "number"
          },
          "hasMask": {
            "type": "boolean"
          },
          "id": {
            "type": "integer"
          },
          "kind": {
            "type": "string"
          },
          "labelColor": {
            "type": "string"
          },
          "linkGroup": {},
          "locks": {},
          "maskEnabled": {},
          "maskLinked": {},
          "name": {
            "type": "string"
          },
          "opacity": {
            "type": "number"
          },
          "selected": {
            "type": "boolean"
          },
          "visible": {
            "type": "boolean"
          }
        },
        "type": "object"
      },
      "type": "array"
    },
    "measurement": {
      "additionalProperties": true,
      "properties": {
        "count": {
          "type": "integer"
        },
        "countGroups": {
          "type": "integer"
        },
        "ruler": {},
        "scale": {
          "type": "string"
        }
      },
      "type": "object"
    },
    "mode": {
      "type": "string"
    },
    "name": {
      "type": "string"
    },
    "notes": {
      "type": "array"
    },
    "quickMask": {
      "type": "boolean"
    },
    "resolution": {
      "type": "number"
    },
    "revision": {
      "type": "integer"
    },
    "selectedLayers": {
      "items": {
        "type": "integer"
      },
      "type": "array"
    },
    "selectionBounds": {},
    "symmetry": {},
    "timeline": {},
    "variables": {},
    "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"
    },
    "document": {
      "description": "a position counted from 0 (the first is 0)",
      "type": "integer"
    },
    "region": {
      "description": "Where the command acts, for this call only: {\"rect\": [x, y, width, height]}, {\"ellipse\": [x, y, width, height]}, {\"polygon\": [[x, y], …]} (3 points or more), {\"layer\": id} (that layer's pixels, by their opacity), {\"channel\": name or index} (a saved selection or alpha channel), or \"all\"; add \"invert\": true to take everything else. Without it, inside the current selection (made with select.* earlier in the run), or everywhere when there is none.",
      "properties": {
        "channel": {
          "x-khp-name": "name",
          "x-khp-role": "object",
          "x-khp-types": [
            "Channel"
          ]
        }
      }
    }
  },
  "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.