Photo kit command

edit.definePattern

Define Pattern…

Saves the selected rectangle `rect` (else the canvas) as a pattern preset named `name`; answers {pattern}.

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

Parameters

Parameters of edit.definePattern
NameTypeRequiredDescription
coalescestringnoMerges consecutive edits with the same key into one undo step, as a slider drag or a typing session is one.
namestringno
rectnumber[]no[x0, y0, x1, y1]
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": "edit.definePattern" }]
}

The required parameters, with placeholders for their types: not a tested example. Optional: coalesce, name, rect, region. photo_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": {
    "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"
    },
    "name": {
      "type": "string"
    },
    "rect": {
      "description": "[x0, y0, x1, y1]",
      "items": {
        "type": "number"
      },
      "type": "array"
    },
    "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"
          ]
        }
      }
    }
  },
  "returns": "{\"pattern\":id} (name: default the document's name numbered past the library's names; rect: default the selection bounds or else the canvas; added to the library from the visible composite)",
  "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.