Extract a K-color palette from a TOP
extract_paletteExtract dominant colors from a TouchDesigner TOP by sampling its preview and applying k-means clustering. Returns hex colors, swatches with weights, and warnings — useful for AI grading, palette creation, and design hand-offs.
Instructions
Sample dominant colors from a TOP by capturing its preview PNG and running deterministic k-means on the decoded RGB pixels. Returns {source_top, k, width, height, pixels_sampled, hex_colors[], swatches[{hex,rgb,weight}], warnings[]} sorted by dominance (most-frequent cluster first). Feeds AI grading prompts, create_palette, and design hand-offs. Read-only; no nodes are created or modified.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| source_top | Yes | Path of the TOP to sample colors from. | |
| k | No | Number of palette colors to extract (2..16). | |
| width | No | Width to render the preview at before sampling (smaller is faster). | |
| height | No | Height to render the preview at before sampling. |