Photo kit command

image.measure

Measure

Answers what can be told exactly beside the pixels: a layer's (or the composite's) non-transparent bounds, pixel count, mean color and luminosity histogram inside a region, and how much it overlaps another layer (`with`). Changes nothing.

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

Parameters

Parameters of image.measure
NameTypeRequiredDescription
coalescestringnoMerges consecutive edits with the same key into one undo step, as a slider drag or a typing session is one.
layerinteger | stringnoA layer's id, whole unique name, or #n from the top.
regionnumber[]no
withinteger | stringnoA layer's id, whole unique name, or #n from the top.

Call through photo_run

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

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

Result

Result of image.measure
NameTypeRequiredDescription
boundsanyno
histograminteger[]no
layeranyno
meananyno
overlapanyno
pixelsintegerno
regioninteger[]no
Result JSON Schema
json
{
  "additionalProperties": true,
  "properties": {
    "bounds": {},
    "histogram": {
      "items": {
        "type": "integer"
      },
      "type": "array"
    },
    "layer": {},
    "mean": {},
    "overlap": {},
    "pixels": {
      "type": "integer"
    },
    "region": {
      "items": {
        "type": "integer"
      },
      "type": "array"
    }
  },
  "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"
    },
    "layer": {
      "description": "A layer's id, whole unique name, or #n from the top.",
      "oneOf": [
        {
          "type": "integer"
        },
        {
          "type": "string"
        }
      ],
      "x-khp-name": "name",
      "x-khp-types": [
        "Layer"
      ]
    },
    "region": {
      "items": {
        "type": "number"
      },
      "type": "array"
    },
    "with": {
      "description": "A layer's id, whole unique name, or #n from the top.",
      "oneOf": [
        {
          "type": "integer"
        },
        {
          "type": "string"
        }
      ],
      "x-khp-name": "name",
      "x-khp-types": [
        "Layer"
      ]
    }
  },
  "returns": "{bounds, pixels, mean, histogram, overlap?}",
  "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.