0

我正在尝试更改图像的方向(CIImage *myImage),但它看起来没有任何效果。

CIImage *myImage2 = [myImage imageByApplyingOrientation:kCGImagePropertyOrientationUp];

我还尝试了其他方法:

CIImage *myImage2 = [myImage imageByApplyingOrientation:[@"1" intValue]];

CIImage *myImage2 = [myImage imageByApplyingTransform:[myImage imageTransformForOrientation:[@"5" intValue]]];

当我试图找出方向是否改变时:

NSLog(@"Image orientation %@",[[myImage properties] valueForKey:kCGImagePropertyOrientation]);

我得到了“空”。也尝试将“myImage2”保存到新图像,但打开后没有效果。看起来“imageByApplyingOrientation”方法根本不起作用。

4

1 回答 1

0

您可以尝试使用方向值进行试验。我注意到在我的图像上使用“1”值也没有效果,但使用“1”以外的值可以。就我而言,值“6”(根据文档,“右,顶部”)结果是我需要的。我从来没有检查过 ciimage 属性,所以我不能说。

于 2015-12-01T22:43:28.040 回答