Added a method to determine the correct orientation of the image using exif data (JPEG and TIFF only)