title: Find images of similar color
body: <p>Based on suggestions here @ SO, I have cataloged the average color for a set of stock images.<br>
      r,g,b = image.convert("RGB").resize((1,1), Image.ANTIALIAS).getpixel((0,0))</p>
  
  <p>Now, I would like to present a color wheel to the user and run a search against my catalog to find images that are the closest match to the color selected.</p>
  
  <p>I have read through several questions posted here that recommend "finding the distance between two colors", and reference the Flickr Hacks book.</p>
  
  <p>The Flickr Hack distance algorithm seems to be basically:  </p>
  
  <hr>
  
  <p>diffr = checkImage.r - search_r<br>
  diffg = checkImage.g - search_g<br>
  diffb = checkImage.b - search_b<br>
  distance = (diffr * diffr + diffg * diffg + diffb * diffb)<br>
  if distance &lt; threshold then matched.  </p>
  
  <hr>
  
  <p>This method would require me to calculate the distance between my search color and every image's color fingerprint.  I was wondering if there is a way to somehow specify a "search area" based on the selected color (center point) and a pre-determined threshold (or search radius).  Then construct a SQL like query to return all images that fall within this area.</p>
  
  <p>Is this possible??</p>
  
  <p>BTW, I'm implementing this in Python using PIL and related libraries.</p>
  
  <p>Thanks for your help SO!</p>
  
  <p>SR</p>