I am attempting to take an image captured from the rear camera, apply a scaling transformation to it and then output a new image with the same size of the original but scaled up.
What I have below works ... BUT it is slow (especially the code in between the UIGraphicsBeginImageContext(size); and UIGraphicsEndImageContext();)
Is there a better way of doing this? In particular, a way that will produce the same result but faster?
UIImage *tempImage = [[UIImage alloc] initWithData:imageData];
CGImageRef img = [tempImage CGImage];
CGFloat width = CGImageGetWidth(img);
CGFloat height = CGImageGetHeight(img);
CGRect bounds = CGRectMake(0, 0, width, height);
CGSize size = bounds.size;
CGFloat z = 5.0;
CGAffineTransform xfrm = CGAffineTransformMakeScale(z, z);
UIGraphicsBeginImageContext(size);
CGContextRef currentContext = UIGraphicsGetCurrentContext();
CGContextConcatCTM(currentContext, xfrm);
CGContextDrawImage(currentContext, bounds, img);
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
Thanks - wg