---
title: "slice.new: Slice Tool — Photo kit command — Kition"
description: "Adds a user web slice at `rect` with slice options (name, kind, URL, target, alt text); answers the slice."
canonical: "https://developer.kition.ai/docs/kits/photo/commands/slice.new"
---

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

# slice.new

**Slice Tool.** Adds a user web slice at `rect` with slice options (name, kind, URL, target, alt text); answers the slice.

- 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 |
| --- | --- | --- | --- |
| `alt` | `any` | no |  |
| `background` | `string` | no | none or #rrggbb |
| `cellText` | `string` | no |  |
| `cellTextIsHtml` | `any` | no |  |
| `coalesce` | `string` | no | Merges consecutive edits with the same key into one undo step, as a slider drag or a typing session is one. |
| `height` | `number` | no | pixels |
| `horizontalAlign` | `integer` | no | 0 to 4 |
| `kind` | `"image" \| "noImage" \| "table"` | no |  |
| `message` | `any` | no |  |
| `name` | `string` | no |  |
| `outsets` | `number[]` | no | [t, l, b, r] |
| `rect` | `number[]` | no | one of several alternative parameters |
| `target` | `string \| object` | no |  |
| `url` | `string` | no |  |
| `verticalAlign` | `integer` | no | 0 to 4 |
| `width` | `number` | no | pixels |
| `x` | `number` | no | pixels; with y, width, height instead of rect; one of several alternative parameters |
| `y` | `number` | no | pixels |

## Call through photo_run

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

The required parameters, with placeholders for their types: not a tested example. Optional: `alt`, `background`, `cellText`, `cellTextIsHtml`, `coalesce`, `height`, `horizontalAlign`, `kind`, `message`, `name`, `outsets`, `rect`, `target`, `url`, `verticalAlign`, `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": {
    "alt": {},
    "background": {
      "description": "none or #rrggbb",
      "type": "string"
    },
    "cellText": {
      "type": "string"
    },
    "cellTextIsHtml": {},
    "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"
    },
    "height": {
      "description": "pixels",
      "type": "number"
    },
    "horizontalAlign": {
      "description": "0 to 4",
      "type": "integer"
    },
    "kind": {
      "enum": [
        "image",
        "noImage",
        "table"
      ],
      "type": "string"
    },
    "message": {},
    "name": {
      "type": "string"
    },
    "outsets": {
      "description": "[t, l, b, r]",
      "items": {
        "type": "number"
      },
      "type": "array"
    },
    "rect": {
      "description": "one of several alternative parameters",
      "items": {
        "type": "number"
      },
      "type": "array"
    },
    "target": {
      "oneOf": [
        {
          "type": "string"
        },
        {
          "additionalProperties": true,
          "type": "object"
        }
      ]
    },
    "url": {
      "type": "string"
    },
    "verticalAlign": {
      "description": "0 to 4",
      "type": "integer"
    },
    "width": {
      "description": "pixels",
      "type": "number"
    },
    "x": {
      "description": "pixels; with y, width, height instead of rect; one of several alternative parameters",
      "type": "number"
    },
    "y": {
      "description": "pixels",
      "type": "number"
    }
  },
  "returns": "{slice, 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).
