title: Evaluate darkness in a UIImage
body: <p>I would like to run a calculation to see if the bottom 20px of a UIImage are generally dark or light. I am displaying a small amount of text on top of this image (one line at the bottom, ie. the bottom 20px), and would like to determine dynamically whether I should make this text black or white.</p>
  
  <p>I am guessing I should be able analyze each pixel in the image for just the region I'm interested in, and then average across all the pixels to determine if the image is generally light or dark in that region. Obviously this won't be an exact science, but it would be better than having to define on 300+ images whether I should show light or dark text for each.</p>
  
  <p>Any ideas?</p>