0
當我在肖像模式中拍照時,savedImage
在設置爲UIImageView
時自動旋轉。從Filemanager加載時自動旋轉的UIImage
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *filePath = [[paths objectAtIndex:0] stringByAppendingPathComponent:@"ProfilePicture.png"];
[UIImagePNGRepresentation(image) writeToFile:filePath atomically:YES];
UIImage *savedImage = [UIImage imageWithData:[NSData dataWithContentsOfFile:filePath]];
但是當我使用UIImageJPEGRepresentation: writeToFile: atomically:
方法,結果圖像沒有問題。
任何人都可以請解釋爲什麼我沒有得到正確的方向圖像,而使用UIImageJPEGRepresentation
&不在UIImagePNGRepresentation
。
注:我試過
UIImage *imageToDisplay =
[UIImage imageWithCGImage:[originalImage CGImage]
scale:[originalImage scale]
orientation: UIImageOrientationUp];
保存imageToDisplay
,但不工作,因爲在JPEG的EXIF數據的旋轉標誌的