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