# How to make a color palette from an image ordered by frequence

**URL:** <https://discourse.processing.org/t/how-to-make-a-color-palette-from-an-image-ordered-by-frequence/4850>\
**Category:** Coding Questions\
**Created:** [October 25, 2018, 2:06am UTC](https://discourse.processing.org/t/how-to-make-a-color-palette-from-an-image-ordered-by-frequence/4850 "2018-10-25T02:06:12Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![BulVvyvXsWDYZl8J](https://avatars.discourse-cdn.com/v4/letter/b/ecae2f/32.png) [@BulVvyvXsWDYZl8J](https://discourse.processing.org/u/BulVvyvXsWDYZl8J)\
**Post date:** [October 30, 2018, 6:58pm UTC](https://discourse.processing.org/t/how-to-make-a-color-palette-from-an-image-ordered-by-frequence/4850/5 "2018-10-30T18:58:04Z")

</div>

> [@jeremydouglass](#):
>
> Can you describe what kind of content you are working with? Is it photographic, illustrative, CGI, some mix?

Doesn’t matter. It should work with any image (i.e. collection of pixels).

> [@jeremydouglass](#):
>
> Supposing your system encountered an image that was random color static (…) what would be a desirable outcome?

Essentially, like I mention in the top post, I could already get this to work by first applying [color quantization](https://discourse.processing.org/t/how-to-apply-color-quantization-to-an-image/4849) to an image and then extracting the most common colours (by checking every pixel).

For that particular image, if I apply color reduction (quantization) with `imagemagick` to 6 colours, I get:

![](https://yyz2.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/e/e67c28fe07fc43f244bdbefa5bbf2907042b2409.png)

Which, as a palette, translates to `#CAC4CB, #363B33, #739893, #A74646, #BB54B7, #44AB46`

> [@jeremydouglass](#):
>
> Do you have particular palette sizes in mind (3, 5, 10, 20?)

It should be customisable.

> [@jeremydouglass](#):
>
> and would you want to bias towards more “noticeable” versions of a color, e.g. full saturation?

I’m not sure. Probably not.

---

_[View the full topic](https://discourse.processing.org/t/how-to-make-a-color-palette-from-an-image-ordered-by-frequence/4850)._
