Tony Crockford on  wrote...
| 
| 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.
| 

Additional...  as you want it for CSS I would quantize it down to four
colors, which will by defination be quite well seperated.

However I would also experiment in using different color spaces.

WARNING: currently the 'cyclic hue' basied color spaces have no idea
that that a hue of  256 and 0 are both "red" so may result in two near
red colors, but never a perfect red.

Simularly it is not likly to pick white and black for a image of a
grayscale gradient, prefering to pick a very light and dark gray
instead.

My notes and discussions about this is in IM examples, Color
Quantization and dithering
   http://imagemagick.org/Usage/quantize/


The Segmentation operator however may work better in some respects, but
only in larger image.


  Anthony Thyssen ( System Programmer )    <[EMAIL PROTECTED]>
 -----------------------------------------------------------------------------
  Serendipity:  Searching for worms and finding gold.
 -----------------------------------------------------------------------------
     Anthony's Home is his Castle     http://www.cit.gu.edu.au/~anthony/
_______________________________________________
Magick-users mailing list
[email protected]
http://studio.imagemagick.org/mailman/listinfo/magick-users

Reply via email to