Photo kit command

shape.edit

Edit Shape

Changes shape layer `layer`'s geometry, fill or stroke.

Kit
Photo 0.1.0 (PSD, PSB, or .kphoto)
Changes the document
yes
Acts on
layer (one id), which a run step’s on fills

Parameters

Parameters of shape.edit
NameTypeRequiredDescription
atnumber[]noInstead of `layer`: a point [x, y] in image pixels; the command acts on the topmost visible layer, not fully locked, with a pixel there (the Move tool's Auto-Select).
backgroundColorstringnoThe background color the command uses, "#rrggbb", for this call only; the current background color by default.
coalescestringnoMerges consecutive edits with the same key into one undo step, as a slider drag or a typing session is one.
fillobjectno"#rrggbb"|[r,g,b,a]|{"gradient":{"stops":[[t,"#hex"]],"angle":deg,"scale":%,"style":"linear|radial|angle|reflected|diamond","reverse":bool}}|{"pattern":name}|null (no fill)?; no fill
fillRule"nonzero" | "evenodd"no
foregroundColorstringnoThe foreground color the command uses, "#rrggbb", for this call only; the current foreground color by default.
fromnumber[]no
kindstringno
layerinteger | stringnoThe layer: its id as inspect lists it, "#n" (the n-th layer of the image's top level as inspect lists it, counted from the top: "#1" is the top one), or its whole name when no other layer has it; the active layer by default.
movenumber[]no[dx, dy]
namestringno
opanyno"combine|…"? + "subpath":index? (default all but the first); default all but the first
pathobjectnoreplaces; drops live shape
radiinumber[]no[tl,tr,br,bl]|r?
rectnumber[]no
sidesintegerno
starRatioanynor?
strokeobjectno{"width":px,"color":"#rrggbb"|fill,"opacity":0..100,"align":"inside|center|outside","cap":"butt|round|square","join":"miter|round|bevel","miterLimit":n,"dashes":[multiples of width],"dashOffset":n}|null? (merged into the current stroke); merged into the current stroke
tonumber[]no
transformnumber[]no[a, b, c, d, e, f]
weightnumbernopixels; live-shape params regenerate the path

Call through photo_run

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

The required parameters, with placeholders for their types: not a tested example. Optional: at, backgroundColor, coalesce, fill, fillRule, foregroundColor, from, kind, layer, move, name, op, path, radii, rect, sides, starRatio, stroke, to, transform, weight. 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": {
    "at": {
      "description": "Instead of `layer`: a point [x, y] in image pixels; the command acts on the topmost visible layer, not fully locked, with a pixel there (the Move tool's Auto-Select).",
      "items": {
        "type": "number"
      },
      "type": "array"
    },
    "backgroundColor": {
      "description": "The background color the command uses, \"#rrggbb\", for this call only; the current background color by default.",
      "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"
    },
    "fill": {
      "description": "\"#rrggbb\"|[r,g,b,a]|{\"gradient\":{\"stops\":[[t,\"#hex\"]],\"angle\":deg,\"scale\":%,\"style\":\"linear|radial|angle|reflected|diamond\",\"reverse\":bool}}|{\"pattern\":name}|null (no fill)?; no fill",
      "properties": {
        "pattern": {
          "x-khp-name": "name",
          "x-khp-role": "object",
          "x-khp-types": []
        }
      }
    },
    "fillRule": {
      "enum": [
        "nonzero",
        "evenodd"
      ],
      "type": "string"
    },
    "foregroundColor": {
      "description": "The foreground color the command uses, \"#rrggbb\", for this call only; the current foreground color by default.",
      "type": "string"
    },
    "from": {
      "items": {
        "type": "number"
      },
      "type": "array"
    },
    "kind": {
      "type": "string"
    },
    "layer": {
      "description": "The layer: its id as inspect lists it, \"#n\" (the n-th layer of the image's top level as inspect lists it, counted from the top: \"#1\" is the top one), or its whole name when no other layer has it; the active layer by default.",
      "oneOf": [
        {
          "type": "integer"
        },
        {
          "type": "string"
        }
      ],
      "x-khp-index": "#",
      "x-khp-index-order": "reversed",
      "x-khp-name": "name",
      "x-khp-types": [
        "Layer"
      ]
    },
    "move": {
      "description": "[dx, dy]",
      "items": {
        "type": "number"
      },
      "type": "array"
    },
    "name": {
      "type": "string"
    },
    "op": {
      "description": "\"combine|…\"? + \"subpath\":index? (default all but the first); default all but the first"
    },
    "path": {
      "additionalProperties": true,
      "description": "replaces; drops live shape",
      "type": "object"
    },
    "radii": {
      "description": "[tl,tr,br,bl]|r?",
      "items": {
        "type": "number"
      },
      "type": "array"
    },
    "rect": {
      "items": {
        "type": "number"
      },
      "type": "array"
    },
    "sides": {
      "type": "integer"
    },
    "starRatio": {
      "description": "r?"
    },
    "stroke": {
      "description": "{\"width\":px,\"color\":\"#rrggbb\"|fill,\"opacity\":0..100,\"align\":\"inside|center|outside\",\"cap\":\"butt|round|square\",\"join\":\"miter|round|bevel\",\"miterLimit\":n,\"dashes\":[multiples of width],\"dashOffset\":n}|null? (merged into the current stroke); merged into the current stroke",
      "properties": {
        "fill": {
          "properties": {
            "pattern": {
              "x-khp-name": "name",
              "x-khp-role": "object",
              "x-khp-types": []
            }
          }
        }
      }
    },
    "to": {
      "items": {
        "type": "number"
      },
      "type": "array"
    },
    "transform": {
      "description": "[a, b, c, d, e, f]",
      "items": {
        "type": "number"
      },
      "type": "array"
    },
    "weight": {
      "description": "pixels; live-shape params regenerate the path",
      "type": "number"
    }
  },
  "returns": "shape.info",
  "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.