This is another code snippet to find dominant colors within a given image in PHP by k-means++ clustering. A more thorough description on how to use it and an explanation how it works will follow soon, as it's intended to be part of a tutorial. Until then, find a description in DominantColors.php.
Requires GD for PHP (which almost all systems will already have installed).
- add Wordpress wrapper function
- add more detailed description
- switch from RGB to LAB color space for results closer to human perception, include as option
- accelerate with triangular equation