Skip to content

Instantly share code, notes, and snippets.

@eleev
Created March 24, 2017 13:08
Show Gist options
  • Save eleev/748bde5d45bb6cba9d76b2f944163dd8 to your computer and use it in GitHub Desktop.
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
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