Created
March 24, 2017 13:08
-
-
Save eleev/748bde5d45bb6cba9d76b2f944163dd8 to your computer and use it in GitHub Desktop.
This calss-level UIImage extension aims to help identifying raw value for UIImageOrientation. This may be useful when warking with CGImage or CIImage classes. Swift 3
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
extension UIImage { | |
class func imageOrientationToTiffOrientation(_ value: UIImageOrientation) -> Int32 { | |
switch (value) { | |
case .up: | |
return 1 | |
case .down: | |
return 3 | |
case .left: | |
return 8 | |
case .right: | |
return 6 | |
case .upMirrored: | |
return 2 | |
case .downMirrored: | |
return 4 | |
case .leftMirrored: | |
return 5 | |
case .rightMirrored: | |
return 7 | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment