title: Javascript image main cluster color
body: <p>I'm looking for a way trough javascript find the main color from a image. Probably trough some algorithm to cluster some areas. </p>
  
  <p>Problem because if I use pixel, will count more pixels used. Ex. if i have brown and very colors next to brown, then a part with white. the main color could be white. And not want color average because could not represent the real color of the image.</p>
  
  <p>Any suggestion of plugins, code to implement, websites . Thanks in advance </p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>Something like this :</p>
  
  <p><a href="http://www.cssdrive.com/imagepalette/" rel="nofollow">http://www.cssdrive.com/imagepalette/</a></p>
  
  <p>There here something explaining, not sure if i can reuse the js code.</p>
  
  <p><a href="http://harthur.wordpress.com/2009/12/18/getting-the-color-scheme-of-a-website-using-canvas-and-hierarchical-clustering/" rel="nofollow">http://harthur.wordpress.com/2009/12/18/getting-the-color-scheme-of-a-website-using-canvas-and-hierarchical-clustering/</a></p>