Color Palette - main colors

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
dognose
Posts: 267
Joined: 2005-03-08T22:16:37-07:00

Color Palette - main colors

Post by dognose » 2014-04-27T11:25:13-07:00

Hi All

I'm trying to extract matching colors from an image.

For example : http://www.degraeve.com/color-palette/

I've tried a few ways with IM, and I can get something close with

" -colors 5 -unique-colors "

then outputing the color data.

But, I'm not happy with the colors listed. They seem more dull and mismactched than the ones with degraeve's site.
Any ideas on how to extract a nice color palette?

Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: Color Palette - main colors

Post by Bonzo » 2014-04-27T11:33:07-07:00

This has been discussed a couple of times before and its just a matter of finding the threads!
Latest one: viewtopic.php?f=1&t=25086&hilit=color+palete

I can not find the interesting one from a few years ago.

User avatar
fmw42
Posts: 25664
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Color Palette - main colors

Post by fmw42 » 2014-04-27T12:09:44-07:00

It would appear that they process the input image to adjust the brightness and contrast or gamma or sigmoidal-contrast so as to make a dull version and vibrant version. However without adding such processing, try reducing the depth first.

compare these (unix syntax)

Image

Code: Select all

list=`convert beach.jpg +dither -colors 5 -unique-colors txt:- | tail -n +2 | sed -n 's/^.*\#.* \(.*\).*$/xc\:\1/p'`
convert -size 50x50 $list -append palette.png
Image

Code: Select all

list=`convert beach.jpg -depth 3 +dither -colors 5 -unique-colors txt:- | tail -n +2 | sed -n 's/^.*\#.* \(.*\).*$/xc\:\1/p'`
convert -size 50x50 $list -append palette2.png
Image


Image

Post Reply