pixel_apply_palette
Snap opaque pixels to the nearest color in a palette to enforce consistent game palette across sprites and clean up stray colors.
Instructions
Snap every opaque pixel to the nearest color in a given palette — enforce a consistent game palette across sprites or clean up stray colors.
Nearest match is by RGB distance; each pixel's alpha is preserved and fully transparent pixels are untouched. Returns JSON {"canvas", "palette_size", "pixels_changed"}; plus a rendered image when preview=true. On failure returns "Error: ...".
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| params | Yes |