K-means groups all pixels into k colour clusters, then replaces every pixel with its cluster's mean colour. Drag the slider to change k and see the trade-off between compression and fidelity.

Original

Quantised (6 colours)

Colour palette