Fix image orientation

Rotate the image according to its orientation before it's shown on screen and cropped.