Fork me on GitHub
Choose An Image
The above plot shows each pixel from the provided input plotted in a 3D RGB (red, green, blue) color space. Note that the image was down sampled for performance.
Extract a Palette
Choose one of the below algorithms to extract a palette from your image
This histogram approach partitions the RGB space into a uniform 3D grid. For example, if 3 is chosen, it will partition the space into a 3x3x3 grid, contain 27 total grid cells. The number of pixels in each cell (histogram bucket) are counted, and the top 10 populated buckets are selected for the color palette. Enter a partitions per dimension value and press Run to try it out.
Histogram Grid Size
Histogram Pixel Bucketing
The median cut approach recursively partitions the space into halves along the principle axes (Red, Green, or Blue) with greatest pixel value range. It will generate a palette with (partitions + 1) colors. Enter a number of partitions, and press Run to try it out.
Median Cut Space Partitioning
k-means attemps to cluster the pixels in to k groups. Since it is susceptible to local minima, it is re-run 100 times and the result with the lowest error is selected. Enter a value for k, and press Run to try it out.
K-Means Pixel Clustering