read_pixels
Extracts pixel colors from a sprite rectangle as rows, hex, or JSON; choose composited visible layers or a specific layer's own pixels.
Instructions
Read the pixels in rect; parts outside the canvas read as transparent.
rows: one character per pixel with a legend of character -> colour, '.' for transparent; x, y, rows and legend can be passed to draw_ascii as they are when the rect is at most 256 pixels wide and tall and the legend has 1 to 256 keys (draw_ascii refuses an empty legend, so an all-transparent read cannot go back). hex: rows of space-separated '#rrggbb'/'#rrggbbaa', '.' for transparent. json: pixels as a list of rows of colours or 'transparent'. Without layer, the visible layers are composited (layer opacity and blend modes applied, hidden layers and groups left out). With layer, that layer's own pixels are read, even when it is hidden, without its opacity. Indexed and grayscale sprites give their RGBA colours. At most ASEPRITE_MCP_MAX_READ_PIXELS pixels (default 65536) per call; use view_sprite to look at larger areas.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"path": "<path>",
"rect": "<rect>"
},
"name": "read_pixels"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | Sprite file. Relative paths resolve against the server root. | |
| rect | Yes | Canvas rectangle to read | |
| frame | No | 1-based frame number | |
| layer | No | Layer name or 'group/child' path for that layer's own pixels; omit for the visible layers composited | |
| format | No | Shape of the returned pixels | rows |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||