Read pixels
read_pixelsRead a rectangular pixel region as structured data—a color palette plus a row-major index grid—for programmatic tasks like sampling palettes, detecting silhouette edges, or copying regions.
Instructions
Read a rectangular region as structured data: a list of distinct colours plus a row-major index grid. Use this when you need to compute over pixels (sample a palette from art, find a silhouette edge, copy a region) rather than just look at them. For eyeballing, 'look' is cheaper.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| frame | No | 1-based frame number. Omit to use the active frame. | |
| layer | No | Layer name. Omit to use the active layer. | |
| region | No | Omit to read the whole canvas. | |
| sprite | No | Sprite filename or id. Omit to use the sprite Aseprite has focused. | |
| composite | No | Read the flattened image. False reads only the target layer's cel. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| x | Yes | ||
| y | Yes | ||
| grid | Yes | Row-major indices into `colors`. | |
| width | Yes | ||
| colors | Yes | Distinct colours; index 0 is fully transparent. | |
| height | Yes | ||
| sprite | Yes | ||
| uniqueColors | Yes |