Automatically generating color palettes from photos

I have been playing around with ways of pulling colors from images or photos and using them to create color palettes in Visions Of Chaos.

Here is a screenshot of the interface.

The basic steps used in selecting the color shades are;
1. Count all colors in the image and keep track of how many times each color appears.
2. Sort the colors into a histogram. Sorting can be based on the frequency the colors appear (from least occuring to most occuring), brightness, RGB components, YUV components or HSL components.
3. Select 16 colors across the histogram. At this stage I select 16 colors as an even spread across the entire histogram.
4. Combine the 16 shades into a 256 color palette.

Which when applied to a Mandelbrot image gives the following result.

Here is the same fractal with palettes created from a photo of trees, a glass of beer and clouds on an overcast day.

Creating color palettes by hand is not easy, so this method allows anyone with a camera (or access to google images search) to take a snapshot and extract a color palette. It doesn’t always result in a pleasing color palette, but there are surprising results that pull out colors you would not expect existed in the original images.

Jason.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s