merge_similar_colors
Merge perceptually similar colors across layers and frames to tighten the palette and keep every animation frame consistent. Optionally cap total colors and snap semi-transparent pixels.
Instructions
Merge colours that are too close to tell apart, across layers and frames.
Colours closer than threshold (OKLab distance: 0.02 is barely visible,
0.04 is a subtle step, 0.08 a clear one) are merged into the most used of
them, so the palette is tight and every frame uses the same colours.
With max_colors > 0 it keeps merging the closest pair until at most that
many colours remain. Semi-transparent pixels are snapped to fully
opaque or empty when snap_alpha.
Args: filename: Aseprite file threshold: Merge colours closer than this (default 0.04) layer_name: "*" = all image layers (default), or one layer frames: "" = every frame max_colors: Optional upper limit on the number of colours snap_alpha: Make alpha 0 or 255 (threshold 128) dry_run: Report the merges without writing
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": {
"filename": "<filename>"
},
"name": "merge_similar_colors"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| frames | No | ||
| dry_run | No | ||
| filename | Yes | ||
| threshold | No | ||
| layer_name | No | * | |
| max_colors | No | ||
| snap_alpha | No |