Spaces:
Sleeping
Sleeping
A newer version of the Gradio SDK is available:
6.4.0
Palette Module
Color quantization and palette generation
Purpose
- Quantize colors to fixed palettes
- Map arbitrary colors to palette entries
- Perform color space conversions
Layout
palette/
βββ context.md # This file
βββ __init__.py # API: create_palette()
βββ quantizer.py # K-means clustering
βββ mapper.py # Color-to-palette mapping
βββ color_space.py # RGB/LAB conversions
Scope
- In-scope: Color quantization, LAB space clustering, nearest neighbor mapping
- Out-of-scope: Image processing, texture generation
Entrypoints
create_palette(colors, size)- Generate palettePaletteMapper(palette)- Map colors to palettequantize_colors(colors, n_colors)- K-means quantization
Dependencies
- Internal: color_space
- External: NumPy, scikit-learn, SciPy