possible fix: - iterate over image once to find the min-Y and max-Y, then divide that space into buckets. - hack: re-run the algorithm with more and more buckets until you've got as many colors as you want. binary search lol example: 
possible fix:
example: