title: Lossless JPEG rotation during decoding with libjpeg
body: <p>I've got a <a href="https://github.com/psobot/smartcrop" rel="nofollow">simple C++ app</a> that decodes JPEGs with libjpeg - however, some of the images it processes come out sideways! These input images have orientations baked in to the EXIF data by the camera, but it seems that during decompression, libjpeg isn't taking the orientation flag into account as many JPEG viewers do.</p>
  
  <p>Is there a way to get libjpeg to respect the orientation of the JPEG during decompression, or will I have to parse out this orientation tag and manually rotate the image?</p>