Extracting colors and sorting/storeing result in a certain way...

Discuss digital image processing techniques and algorithms. We encourage its application to ImageMagick but you can discuss any software solutions here.
Post Reply
mcc
Posts: 2
Joined: 2017-01-02T04:10:44-07:00
Authentication code: 1151

Extracting colors and sorting/storeing result in a certain way...

Post by mcc »

Hi,

For creating materials and textures for the rendering engine Cycles in Blender I want to extract colors from images.
Since Blender's node-system to create materials and texture already has a couple of ways to create and modify
colors and images can have a huge amount of different colors I am looking for a "non destructive way" :) of information
transfer between ImageMagick and Blender.

This could go as follows:
Extract all colors from an image
Convert the colors from RGB to HSV (for exmaple)
Sort the colors "somehow"
Group the sorted colors
For each group create a color chart with values (hex preferred).

There are some questions hidden behind this:
1.) How can I create a list of colors from a color image (jpg/png) ?
2.) What is the best way to sort the result (For example: Sort hues and inside the hues the saturation and then the values?)
3.) What groups should be builded?
4.) How can I create handy color charts (not theses over length "one color field x 2000 color fields"-sized color "ramps"...) for
each group?

Additionally: My color vision is not the best....so I need a "academic" way to sort/group things not "look for the most reddish one" ;)

Thank you very much in advance for any help!
Happy and colorful new year!
mcc
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Extracting colors and sorting/storeing result in a certain way...

Post by fmw42 »

What is your IM version and platform? Syntax differs on different platforms and especially when you have to create a script to do sorting.

1) see the IM function -unique-colors or -format "%c" histogram:info:
http://www.imagemagick.org/Usage/files/#histogram
http://www.imagemagick.org/Usage/quantize/#extract

2) you can change colorspace to HSL using -colorspace HSL, then do the histogram. See
http://www.imagemagick.org/Usage/color_ ... olorspaces
http://www.imagemagick.org/Usage/color_basics/#separate

If on Unix-based system, see my script, spectrumhist, at my link below, where I sort colors in different ways.
mcc
Posts: 2
Joined: 2017-01-02T04:10:44-07:00
Authentication code: 1151

Re: Extracting colors and sorting/storeing result in a certain way...

Post by mcc »

Hi,

I am using media-gfx/imagemagick-6.9.6.6 on GENTOO-Linux.

Thanks for all the links! I will see how I can adopt that to my needs.

Cheers
mcc
Post Reply