---
title: "image.canvasSize: Canvas Size… — Photo kit command — Kition"
description: "Changes the canvas to `width`×`height` px (or by them with `relative`) around `anchor`, without scaling layers; new area takes `extensionColor`, shrinking crops."
canonical: "https://developer.kition.ai/docs/kits/photo/commands/image.canvasSize"
---

> Canonical HTML: [https://developer.kition.ai/docs/kits/photo/commands/image.canvasSize](https://developer.kition.ai/docs/kits/photo/commands/image.canvasSize)

# image.canvasSize

**Canvas Size….** Changes the canvas to `width`×`height` px (or by them with `relative`) around `anchor`, without scaling layers; new area takes `extensionColor`, shrinking crops.

- Kit: Photo 0.1.0 (PSD, PSB, or .kphoto); reference: [Photo kit commands](https://developer.kition.ai/docs/kits/photo.md)
- Changes the document: yes

## Parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `anchor` | `"topLeft" \| "top" \| "topRight" \| "left" \| "center" \| "right" \| "bottomLeft" \| "bottom" \| "bottomRight"` | no |  |
| `backgroundColor` | `string` | no | The background color the command uses, "#rrggbb", for this call only; the current background color by default. |
| `coalesce` | `string` | no | Merges consecutive edits with the same key into one undo step, as a slider drag or a typing session is one. |
| `extensionColor` | `"background" \| "foreground" \| "white" \| "black" \| "transparent" \| "#rrggbb"` | no |  |
| `foregroundColor` | `string` | no | The foreground color the command uses, "#rrggbb", for this call only; the current foreground color by default. |
| `height` | `number` | no | Pixels; the resulting canvas side is rounded and clamped to 1..300000. With relative canvas sizing this parameter is a delta. |
| `relative` | `boolean` | no |  |
| `width` | `number` | no | Pixels; the resulting canvas side is rounded and clamped to 1..300000. With relative canvas sizing this parameter is a delta. |

## Call through photo_run

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

The required parameters, with placeholders for their types: not a tested example. Optional: `anchor`, `backgroundColor`, `coalesce`, `extensionColor`, `foregroundColor`, `height`, `relative`, `width`. 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": {
    "anchor": {
      "default": "center",
      "enum": [
        "topLeft",
        "top",
        "topRight",
        "left",
        "center",
        "right",
        "bottomLeft",
        "bottom",
        "bottomRight"
      ],
      "type": "string"
    },
    "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"
    },
    "extensionColor": {
      "default": "background",
      "enum": [
        "background",
        "foreground",
        "white",
        "black",
        "transparent",
        "#rrggbb"
      ],
      "type": "string"
    },
    "foregroundColor": {
      "description": "The foreground color the command uses, \"#rrggbb\", for this call only; the current foreground color by default.",
      "type": "string"
    },
    "height": {
      "description": "Pixels; the resulting canvas side is rounded and clamped to 1..300000. With relative canvas sizing this parameter is a delta.",
      "type": "number"
    },
    "relative": {
      "default": false,
      "type": "boolean"
    },
    "width": {
      "description": "Pixels; the resulting canvas side is rounded and clamped to 1..300000. With relative canvas sizing this parameter is a delta.",
      "type": "number"
    }
  },
  "type": "object"
}
```

Generated from the command list of @kition/photo-darwin-arm64@0.1.0 and the kit itself (photo_commands through @kition/cli@0.1.1, built from KitionAI/kition-photo@abe3f30).
