# How to apply color quantization to an image

**URL:** <https://discourse.processing.org/t/how-to-apply-color-quantization-to-an-image/4849>\
**Category:** Coding Questions\
**Created:** [October 25, 2018, 2:01am UTC](https://discourse.processing.org/t/how-to-apply-color-quantization-to-an-image/4849 "2018-10-25T02:01:44Z")\
**Posts on this page:** 1\
**Showing post:** 23

<div class="post-metadata">

**Author:** ![jeremydouglass](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jeremydouglass/32/20_2.png) [@jeremydouglass](https://discourse.processing.org/u/jeremydouglass)\
**Post date:** [October 31, 2018, 5:07pm UTC](https://discourse.processing.org/t/how-to-apply-color-quantization-to-an-image/4849/23 "2018-10-31T17:07:51Z")

</div>

In the other thread, @Kevin also shares some code he wrote to do k-means color clustering using opencv.Mat.

> [@How to make a color palette from an image ordered by frequence](https://discourse.processing.org/t/how-to-make-a-color-palette-from-an-image-ordered-by-frequence/4850/10):
>
> I’ve done something similar in the past by using k-means to cluster the colors. Some posts that you might find interesting:

---

_[View the full topic](https://discourse.processing.org/t/how-to-apply-color-quantization-to-an-image/4849)._
