On 15 May 2008, at 19:20, Fred Weinhaus wrote:

> It depends upon what you mean by predominant color.
>
> If the image is 24-bit color, then you have real trouble as there are
> millions of colors and finding a single predominant color is not easy.
>
> However, you can reduce the image down to a single pixel and get the
> color of that pixel. For example
>
> convert rose: -resize 1x1 miff:- | convert - -format
> "rgb(%[fx:int(255*u.p{0,0}.r)],%[fx:int(255*u.p{0,0}.g)],% 
> [fx:int(255*u.p{0,0}.b)])"
> info:
>
>
>
> Or you may quantize the colors of the image to a reasonable number
> and then look at the histogram to find the most frequently used
> color.  See -colors


that sounds like a plan.

I was hoping to be able to create a CSS color scheme based on colors  
found in a company logo.

I realise there are many potential pitfalls, like background color may  
be the most predominant, but I thought some preprocessing might  
resolve that.

I think I have enough clues to get started down the proper path.

Thanks again all.
_______________________________________________
Magick-users mailing list
[email protected]
http://studio.imagemagick.org/mailman/listinfo/magick-users

Reply via email to