CIImage:如何使用Objective-C OS X检查图像方向是否已更改?

时间:2015-03-27 09:50:43

标签: objective-c macos ciimage

我正在尝试更改图像的方向(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]);

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

1 个答案:

答案 0 :(得分:0)

您可以尝试尝试使用方向值。我注意到使用" 1"的值在我的图像上也没有任何效果,但使用的不是" 1"没有。就我而言,价值" 6" ('对,顶部'根据文档)原来是我需要的。我从未检查过ciimage属性属性,所以我无法说出来。