title: How to tell if an image is light or dark using ruby?
body: <p>Is there any way to tell if an image is light or dark in ruby?</p>
  <p>The use case is as a user uploads an image, the application (e.g. the controller in a rails app) could automatically detect whether an image is light or dark and record that result so the view can place the image on an appropriate background for maximal contrast.</p>
  <p>I found similar answers <a href="https://stackoverflow.com/a/52506830/5783745">here</a> for python and <a href="https://stackoverflow.com/questions/16265041/detect-if-image-is-mostly-dark-or-light-in-javascript">here</a> for javascript, but couldn't spot the equivalent in ruby</p>