title: How to Determine and Auto-Rotate Images?
body: <p>I have bunch of images, among them some of the images have to be rotated. </p>
  
  <p>Sample:</p>
  
  <p><img src="https://i.stack.imgur.com/tA8nA.png" alt="enter image description here"></p>
  
  <p>I want to rotate this image 90° counter-clockwise.</p>
  
  <p>I Googled to know how can I rotate an image and found many links and SO threads. But how can I <strong>determine if the image needs to be rotated</strong>? Picasa has a Auto-Rotating feature. I want to have similar functionality.</p>
  
  <p>Any pointer would be very helpful to me.</p>
  
  <p>I have found a <a href="https://stackoverflow.com/questions/12726860/android-how-to-detect-the-image-orientation-portrait-or-landscape-picked-fro">link</a> but it is related to Android.</p>