CLIP CIRCLE PART OF AN SQUARE IMAGE WITH PATH

UIImage *imageOld = [UIImage imageNamed:@”GC.png”];

CGSize newSize = CGSizeMake(imageOld.size.width, imageOld.size.height);

UIGraphicsBeginImageContext(newSize);

CGContextRef context = UIGraphicsGetCurrentContext();
CGMutablePathRef path = CGPathCreateMutable();
CGPathAddEllipseInRect(path, NULL, CGRectMake(0, 0, imageOld.size.width, imageOld.size.height));
CGContextAddPath(context, path);
CGContextClip(context);
CGPathRelease(path);
CGPoint topLeftOffset = CGPointMake(0,0);
[imageOld drawAtPoint: topLeftOffset];

UIImage *newCircleImage = UIGraphicsGetImageFromCurrentImageContext();

UIGraphicsEndImageContext();

CLIP CIRCLE PART OF AN SQUARE IMAGE WITH PATH