quantize_to_palette
Snap every visible pixel in an RGB sprite layer to a non-transparent palette color chosen by RGB distance while preserving alpha; empty frames are skipped and indexed or grayscale sprites are rejected.
Instructions
Snap every visible pixel of a layer of an RGB sprite to its nearest palette colour.
Nearest is by RGB distance among the palette's non-transparent entries; each pixel keeps its alpha. Indexed sprites (pixels are palette entries already) and grayscale sprites (their palette is always the 256 grays) are refused. Frames without a cel are skipped. Linked cels are handled like replace_colors. changed counts the pixels that got a new value.
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>",
"layer": "<layer>"
},
"name": "quantize_to_palette"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | Sprite file. Relative paths resolve against the server root. | |
| layer | Yes | Layer name, or a 'group/child' path for nested layers | |
| frames | No | Frames: a number, "1-4", "1-4,7" or "all" (1-based) |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||