Created
January 29, 2013 18:43
-
-
Save steipete/4666527 to your computer and use it in GitHub Desktop.
Exif -> UIImageOrientation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Convert an EXIF image orientation to an iOS one. | |
// reference see here: http://sylvana.net/jpegcrop/exif_orientation.html | |
+ (UIImageOrientation) exifOrientationToiOSOrientation:(int)exifOrientation { | |
UIImageOrientation o = UIImageOrientationUp; | |
switch (exifOrientation) { | |
case 1: o = UIImageOrientationUp; break; | |
case 3: o = UIImageOrientationDown; break; | |
case 8: o = UIImageOrientationLeft; break; | |
case 6: o = UIImageOrientationRight; break; | |
case 2: o = UIImageOrientationUpMirrored; break; | |
case 4: o = UIImageOrientationDownMirrored; break; | |
case 5: o = UIImageOrientationLeftMirrored; break; | |
case 7: o = UIImageOrientationRightMirrored; break; default: break; | |
} | |
return o; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment