Some time in late 2018, I watched a Computerphile video about k-means clustering and thought it was very interesting, so I decided to make my own program for splitting up images into regions of block colour.

The starting means are randomly chosen, so the final clusters are not deterministic. Therefore, each time you segment the image, you might get a different palette. I originally wanted to change this but actually, I quite like it - you can keep trying until you get a palette you like. (It's a feature, not a bug, I promise!)

The Colours input indicates the amount of colours to split the image into, and the Iterations input indicates the amount of iterations of the k-means algorithm to apply (the higher this is, the slower the process but the better the clustering will be). I tried this with some large pictures and ran out of heap space, so allocate more memory if you plan to do that.



To do