Reputation: 689
I'm interested in implementing a tool similar to Canva's Palette tool, with the final goal of production CSS UI colors from an image (similar to how Spotify determines UI colors based on album art).
I've read about color quantization using the octree data type. But I'm wondering if this will lead me to the solution, or if octree quantization is simply for compression.
Any help towards my goal is greatly appreciated!
Upvotes: 1
Views: 232
Reputation: 32878
There are many ways to find an image's dominant colors. These include not only octrees but also k-means clustering, histograms, and posterization. Some of them can indeed be used to find an image's color palette, if we treat the problem as finding not just one dominant color, but the N dominant colors of that image.
You should implement octrees or another dominant-color-finding method first and see whether that implementation suits your purposes, then ask other questions on this site if you have further issues.
Upvotes: 1