Created
December 2, 2014 11:07
-
-
Save naotty/4e371fb11b848f1585ec to your computer and use it in GitHub Desktop.
カメラで撮った写真が勝手に90度回転するのを戻す
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
// 勝手に90度回転するのを元に戻す | |
// cf. http://blog.katty.in/105 | |
- (UIImage *)fixImageRotation:(UIImage *)originalImage | |
{ | |
if(originalImage.imageOrientation != UIImageOrientationUp){ | |
UIGraphicsBeginImageContextWithOptions(originalImage.size, NO, originalImage.scale); | |
[originalImage drawInRect:(CGRect){0, 0, originalImage.size}]; | |
originalImage = UIGraphicsGetImageFromCurrentImageContext(); | |
UIGraphicsEndImageContext(); | |
} | |
return originalImage; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
iPhoneカメラで撮影した画像のUIImageからCGImageを取り出すと90度傾く問題の解決法 より