102 points · by cgs · 13y ago · 9 comments
1. pick 500 random points from the album art
2. cluster them in 10 classes (k-means is an old, well understood algorithm)
3. pick the median point of dominant class for the bg
4. pick a contrasting color from a different cluster for the text
for 4 you want that, picking from one of the colors of the album or a contrasting color if this is not available from the album
For those that are curious, what happens under the covers is a random sampling of the image followed by a conversion to LAB color space (even better than YUV in terms of human perception) and finally some K-means clustering.
To see this in action, check out http://tightro.pe.