Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/109.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 从Filemanager加载时,UIImage会自动旋转_Ios_Objective C_Uiimageview_Uiimage - Fatal编程技术网

Ios 从Filemanager加载时,UIImage会自动旋转

Ios 从Filemanager加载时,UIImage会自动旋转,ios,objective-c,uiimageview,uiimage,Ios,Objective C,Uiimageview,Uiimage,在纵向模式下拍照时,当设置为UIImageView时,savedImage会自动旋转 但是当我使用UIImageJPEGRepresentation:writeToFile:Atomicaly:method时,结果图像没有问题 有人能解释一下为什么我在使用UIImageJPEGRepresentation&而不是在UIImagePNGRepresentation时,图像的方向不正确吗 NB:我试过了 UIImage *imageToDisplay = [UIImage imageWit

在纵向模式下拍照时,当设置为UIImageView时,savedImage会自动旋转

但是当我使用UIImageJPEGRepresentation:writeToFile:Atomicaly:method时,结果图像没有问题

有人能解释一下为什么我在使用UIImageJPEGRepresentation&而不是在UIImagePNGRepresentation时,图像的方向不正确吗

NB:我试过了

UIImage *imageToDisplay =
     [UIImage imageWithCGImage:[originalImage CGImage]
              scale:[originalImage scale]
              orientation: UIImageOrientationUp];

由于JPEG的EXIF数据中的旋转标志,要将图像保存为显示,但不工作

。每个图像文件都有元数据属性。如果元数据指定了图像的方向,则除Mac外,其他操作系统通常会忽略该方向。拍摄的大多数图像的元数据属性都设置为直角。所以Mac以90度旋转的方式显示它。您可以在windows操作系统中以正确的方式查看相同的图像。请检查显示更多详细信息的答案

UIImage *imageToDisplay =
     [UIImage imageWithCGImage:[originalImage CGImage]
              scale:[originalImage scale]
              orientation: UIImageOrientationUp];