Upvote:4

Aprove answer
UIGraphicsBeginImageContext(targetSize);
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSetInterpolationQuality(context, kCGInterpolationLow);
...

Upvote:1

CGImageRef imageRef = CGImageCreateWithImageInRect([self CGImage], theRect); // e.g. theRect={{100,100, {200, 200}}

UIImage *finalImage = [UIImage imageWithCGImage:imageRef];

Credit Goes to: stackoverflow.com

Related question with same questions but different answers