title: How to automatic adjust color and contrast
body: <p>in my project i want to implement a modul which add or remove contrast to a given  picture automatically.
  My problem is, to find out how much contrast i can add or remove.
  I know about photoshops auto-contrast/auto-color function. Can someone explain me how it works or a theory/paper/idea how to implement this?</p>
  
  <p>I know, there is a histogram-equalization feature. But that's not the feature i'm seeking for.</p>
  
  <p>For example i want to choose one of this three gradiant-curves,which match with the image.</p>
  
  <p><a href="https://i.stack.imgur.com/rqLXR.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/rqLXR.jpg" alt="Image Hosted by ImageShack.us"></a>
  <a href="https://i.stack.imgur.com/CTuW5.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/CTuW5.jpg" alt="Image Hosted by ImageShack.us"></a>
  <a href="https://i.stack.imgur.com/YR2iY.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/YR2iY.jpg" alt="Image Hosted by ImageShack.us"></a>
  </p>
  
  <p>greetings</p>