Photo kit command

image.crop

Crop

Crops the canvas to the rectangle `x`,`y`,`width`,`height` px, optionally rotated by `angle`; `deleteCroppedPixels: false` keeps hidden pixels outside.

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

Parameters

Parameters of image.crop
NameTypeRequiredDescription
angleintegerno-3600 to 3600
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.
deleteCroppedPixelsbooleanno
foregroundColorstringnoThe foreground color the command uses, "#rrggbb", for this call only; the current foreground color by default.
heightnumbernopixels
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.
widthnumbernopixels
xnumbernopixels
ynumbernopixels

Call through photo_run

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

The required parameters, with placeholders for their types: not a tested example. Optional: angle, backgroundColor, coalesce, deleteCroppedPixels, foregroundColor, height, region, width, x, y. 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": {
    "angle": {
      "default": 0,
      "description": "-3600 to 3600",
      "type": "integer"
    },
    "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"
    },
    "deleteCroppedPixels": {
      "default": true,
      "type": "boolean"
    },
    "foregroundColor": {
      "description": "The foreground color the command uses, \"#rrggbb\", for this call only; the current foreground color by default.",
      "type": "string"
    },
    "height": {
      "description": "pixels",
      "type": "number"
    },
    "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"
          ]
        }
      }
    },
    "width": {
      "description": "pixels",
      "type": "number"
    },
    "x": {
      "description": "pixels",
      "type": "number"
    },
    "y": {
      "description": "pixels",
      "type": "number"
    }
  },
  "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.