Draw
drawApply multiple pixel-art operations to one cel as a single undoable action, including shapes, text, fills, gradients, and grids, with optional palette locking.
Instructions
Apply a batch of drawing operations to one cel, as a single undoable action. Ops: pixels, line, polyline, rect, ellipse, fill, replace, dither, gradient, clear, blit, text, grid. Batch aggressively — a whole sprite in one call is normal and correct, and it means the user can undo your work with one Ctrl+Z. Set paletteLock (default true) to snap every colour to the sprite's palette by perceptual distance before anything is written, so you cannot silently widen a curated palette. Ops run in array order, so paint fills before outlines and outlines before highlights. 'text' is laid out here from a bitmap font and expanded to plain pixels before it reaches Aseprite — pass measureOnly: true with only 'text' ops to get each one's ink bounds without touching the sprite, e.g. to centre a label first. 'grid' paints a picture written as text — one character per pixel, a legend mapping characters to colours, the same shape look op="ascii" returns — so you can see the whole silhouette while you write it instead of composing it from shapes. It is the easiest way to draw a small sprite or a whole animation frame, and to edit one: read a region with look op="ascii" layer=… rulers=false, change the rows, and send them back as a grid at the region's x/y.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ops | Yes | Applied in order, in one transaction. | |
| frame | No | 1-based frame number. Omit to use the active frame. | |
| label | No | Name shown in Aseprite's undo history. Describe the intent, e.g. 'shade helmet'. | |
| layer | No | Layer name. Omit to use the active layer. | |
| sprite | No | Which sprite: its id as '#7' (what every result reports back, and the only unambiguous form — two unsaved documents are both called 'Sprite'), its filename, or its display name. Omit to use the sprite Aseprite has focused. | |
| createCel | No | Create the cel if the target layer/frame has none. | |
| measureOnly | No | Every op must be 'text'. Returns each one's ink bounds without calling Aseprite at all — use to size a panel or centre a label before actually drawing it. | |
| paletteLock | No | Snap every colour to the nearest palette entry (CIELAB ΔE). Set false only when the user asked to introduce new colours. | |
| selectionOnly | No | Clip every op to the current selection. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| frame | No | ||
| layer | No | ||
| bounds | No | Bounding box actually touched. | |
| sprite | No | ||
| opsApplied | No | ||
| textBounds | No | Only present when `measureOnly` was set. | |
| measureOnly | No | ||
| colorsSnapped | No | Colours palette-lock moved, and how far. A large ΔE means the palette lacks that colour. | |
| pixelsChanged | No |