---
title: "layer.autoTrace: Auto-trace — Motion kit command — Kition"
description: "Traces the edges of `layer` (its `channel`: alpha, red, green, blue or luminance) into masks, at the current frame or over the work area (`timeSpan`): `threshold`, `blur`, `tolerance`, `minimumArea`, `cornerRoundness`, `invert`; `applyToNewLayer` puts the masks on a new solid."
canonical: "https://developer.kition.ai/docs/kits/motion/commands/layer.autoTrace"
---

> Canonical HTML: [https://developer.kition.ai/docs/kits/motion/commands/layer.autoTrace](https://developer.kition.ai/docs/kits/motion/commands/layer.autoTrace)

# layer.autoTrace

**Auto-trace.** Traces the edges of `layer` (its `channel`: alpha, red, green, blue or luminance) into masks, at the current frame or over the work area (`timeSpan`): `threshold`, `blur`, `tolerance`, `minimumArea`, `cornerRoundness`, `invert`; `applyToNewLayer` puts the masks on a new solid.

- Kit: Motion 0.1.0 (.kmotion); reference: [Motion kit commands](https://developer.kition.ai/docs/kits/motion.md)
- Changes the document: yes
- Acts on: `layer` (one id), which a run step’s `on` fills

## Parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `applyToNewLayer` | `boolean` | no |  |
| `blur` | `number` | no | px, 1 |
| `channel` | `"alpha" \| "red" \| "green" \| "blue" \| "luminance"` | no |  |
| `cornerRoundness` | `number` | no | %, 50 |
| `invert` | `boolean` | no |  |
| `layer` | `integer \| string` | no |  |
| `minimumArea` | `number` | no | px, 10 |
| `threshold` | `number` | no | %, 50 |
| `timeSpan` | `"currentFrame" \| "workArea"` | no |  |
| `tolerance` | `number` | no | px, 1 |

## Call through motion_run

```text
motion_run {
  "path": "<file>.kmotion",
  "steps": [{ "command": "layer.autoTrace" }]
}
```

The required parameters, with placeholders for their types: not a tested example. Optional: `applyToNewLayer`, `blur`, `channel`, `cornerRoundness`, `invert`, `layer`, `minimumArea`, `threshold`, `timeSpan`, `tolerance`. motion_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": {
    "applyToNewLayer": {
      "type": "boolean"
    },
    "blur": {
      "description": "px, 1",
      "type": "number"
    },
    "channel": {
      "enum": [
        "alpha",
        "red",
        "green",
        "blue",
        "luminance"
      ],
      "type": "string"
    },
    "cornerRoundness": {
      "description": "%, 50",
      "type": "number"
    },
    "invert": {
      "type": "boolean"
    },
    "layer": {
      "oneOf": [
        {
          "description": "layer id as motion_inspect lists it (when no layer has that id, its 1-based stack position)",
          "type": "integer"
        },
        {
          "description": "layer id as receipts print it (\"51\"), a layer name, or #n for the n-th from the top",
          "type": "string"
        }
      ],
      "x-khp-index": "#",
      "x-khp-index-numbers": true,
      "x-khp-name": "name",
      "x-khp-types": [
        "Layer"
      ]
    },
    "minimumArea": {
      "description": "px, 10",
      "type": "number"
    },
    "threshold": {
      "description": "%, 50",
      "type": "number"
    },
    "timeSpan": {
      "enum": [
        "currentFrame",
        "workArea"
      ],
      "type": "string"
    },
    "tolerance": {
      "description": "px, 1",
      "type": "number"
    }
  },
  "type": "object"
}
```

Generated from the command list of @kition/motion-darwin-arm64@0.1.0 and the kit itself (motion_commands through @kition/cli@0.1.1, built from KitionAI/kition-motion@4719aa7).
