In my iPhone app, I've always used the following function to horizontally mirror
an image.
-(UIImage*)mirrorImage:(UIImage*)img
{
CIImage *coreImage = [CIImage imageWithCGImage:img.CGImage];
coreImage = [coreImage imageByApplyingTransform:CGAffineTransformMakeScale(-1, 1)];
img = [UIImage imageWithCIImage:coreImage scale:img.scale orientation:UIImageOrientationUp];
return img;
}
With iOS 10.0.1 though, this function still runs with no errors, but when I try to use the UIImage
from this function, the following warning appears, and the image just doesn't seem to be there.
Failed to render 921600 pixels because a CIKernel's ROI function did not allow tiling.
This error actually appears in the Output window when I attempt to use the UIImage
(in the second line in this code) :
UIImage* flippedImage = [self mirrorImage:originalImage];
UIImageView* photo = [[UIImageView alloc] initWithImage:flippedImage];
After calling mirrorImage
, the flippedImage
variable does contain a value, it's not nil
, but when I try to use the image, I get that error message.
If I were to not call the mirrorImage
function, then the code works fine:
UIImageView* photo = [[UIImageView alloc] initWithImage:originalImage];
Is there some new quirk with iOS 10
which would prevent my mirrorImage
function from working ?
Just to add, in the mirrorImage
function, I tried testing the size of the image before and after the transformation (as the error is complaining about having to tile
the image), and the size is identical.