gpt4 book ai didi

ios - 被纵向/横向模式照片的 UIImageOrientation 搞糊涂了

转载 作者:塔克拉玛干 更新时间:2023-11-02 08:03:34 25 4
gpt4 key购买 nike

我使用 ios 的系统相机拍了两张照片,一张是纵向模式,另一张是横向模式,然后我使用 imagePicker 在我的应用程序中挑选它们,如下所示:

-(void) imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info{

UIImage* sourceImage = [info objectForKey:UIImagePickerControllerOriginalImage];


UIImageOrientation imageOrientation = sourceImage.imageOrientation;
NSLog(@"%d",imageOrientation);

}

请注意,我 NSLog 输出了我刚刚挑选出的图像的 UIImageOrientation 值。结果是纵向模式照片的值为 3(表示 UIImageOrientationRight),横向模式照片为 0(UIImageOrientationUp) 我只是不明白为什么。谁能解释一下?谢谢!

最佳答案

iPhone 的相机无论设备方向如何都会保存照片,但它会向图像添加元信息以允许正确呈现此图像。 imageOrientation 描述图像应该旋转多少度才能正确呈现。

关于ios - 被纵向/横向模式照片的 UIImageOrientation 搞糊涂了,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17921789/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com