extract_palette
Extract a color palette from a PNG image using median-cut quantization. Returns hex colors and a swatch for use in pixel art creation.
Instructions
Extract a color palette from a PNG supplied as exactly one of png_base64 or path, with median-cut quantization, WITHOUT creating a document. Returns a list of hex colors ready to pass to create_document(palette=[...]) (or add_palette_color), plus a swatch render so the colors are visible. Use this to pull a palette from a reference image; use open_document when you also want its pixels.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | No | Path to a PNG on the server filesystem (mutually exclusive with png_base64) | |
| sort | No | Order of the returned colors and swatch (default luminance, dark to light) | |
| max_colors | No | Max colors to extract (default 16) | |
| png_base64 | No | PNG file content, base64-encoded (mutually exclusive with path) |