I implemented a web page that can apply color quantization to images using k-means clustering. Here’s the link:
https://dstein64.github.io/k-means-quantization-js/
The JavaScript source code is available on GitHub:
https://github.com/dstein64/k-means-quantization-js
Below are some examples of quantized images.
The originals are available on http://photos.dannyadam.com/.