extract_palette
Extract an optimal color palette from a sprite using quantization, apply it, and return the colors.
Instructions
Build an OPTIMAL palette from the sprite via native ColorQuantization.
True palette extraction (vs the nearest-snap quantize_to_palette): writes the resulting palette to the sprite and returns it. NOTE: mutates the sprite's palette. Sprite must be in RGB mode.
Args: filename: Aseprite file to modify max_colors: palette size cap, 1..256 (fewer if the art has fewer) with_alpha: include alpha when quantizing
Returns: JSON {colors: [#RRGGBB, ...], count}
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| filename | Yes | ||
| max_colors | No | ||
| with_alpha | No |