---
title: "select.magneticLasso: Magnetic Lasso — Photo kit command — Kition"
description: "Selects along edges between `points`, snapping to edges of `contrast` within `width` px (`trace`), like the magnetic lasso; `mode` replaces, adds to, subtracts from or intersects the current selection."
canonical: "https://developer.kition.ai/docs/kits/photo/commands/select.magneticLasso"
---

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

# select.magneticLasso

**Magnetic Lasso.** Selects along edges between `points`, snapping to edges of `contrast` within `width` px (`trace`), like the magnetic lasso; `mode` replaces, adds to, subtracts from or intersects the current selection.

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

## Parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `antiAlias` | `boolean` | no |  |
| `close` | `"magnetic" \| "straight"` | no | how the last point joins the first |
| `coalesce` | `string` | no | Merges consecutive edits with the same key into one undo step, as a slider drag or a typing session is one. |
| `contrast` | `integer` | no | 1 to 100; %: weaker edges are ignored |
| `feather` | `integer` | no | 0 to 1000; px |
| `mode` | `"replace" \| "add" \| "subtract" \| "intersect"` | no |  |
| `points` | `number[][]` | no | ≥3 fastening points in order; with trace=false, the finished outline |
| `trace` | `boolean` | no |  |
| `width` | `integer` | no | 1 to 256; px: follows edges this close to the points |

## Call through photo_run

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

The required parameters, with placeholders for their types: not a tested example. Optional: `antiAlias`, `close`, `coalesce`, `contrast`, `feather`, `mode`, `points`, `trace`, `width`. photo_run answers the step’s result in `completed[i].result`.

## Result



```json
{
  "additionalProperties": true,
  "description": "an object; the command's description says what it holds",
  "properties": {},
  "type": "object"
}
```

## Parameter schema

```json
{
  "additionalProperties": false,
  "properties": {
    "antiAlias": {
      "default": true,
      "type": "boolean"
    },
    "close": {
      "default": "magnetic",
      "description": "how the last point joins the first",
      "enum": [
        "magnetic",
        "straight"
      ],
      "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"
    },
    "contrast": {
      "default": 10,
      "description": "1 to 100; %: weaker edges are ignored",
      "type": "integer"
    },
    "feather": {
      "default": 0,
      "description": "0 to 1000; px",
      "type": "integer"
    },
    "mode": {
      "default": "replace",
      "enum": [
        "replace",
        "add",
        "subtract",
        "intersect"
      ],
      "type": "string"
    },
    "points": {
      "description": "≥3 fastening points in order; with trace=false, the finished outline",
      "items": {
        "items": {
          "type": "number"
        },
        "type": "array"
      },
      "type": "array"
    },
    "trace": {
      "default": true,
      "type": "boolean"
    },
    "width": {
      "default": 10,
      "description": "1 to 256; px: follows edges this close to the points",
      "type": "integer"
    }
  },
  "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).
