+(UIImage*)circularScaleAndCropImage:(UIImage*)image{// Create the bitmap graphics contextUIGraphicsBeginImageContextWithOptions(CGSizeMake(image.size.width,image.size.height),NO,0.0);CGContextRefcontext=UIGraphicsGetCurrentContext();// Get the width and heightsCGFloatimageWidth=image.size.width;CGFloatimageHeight=image.size.height;// Calculate the centre of the circleCGFloatimageCentreX=imageWidth/2;CGFloatimageCentreY=imageHeight/2;// Create and CLIP to a CIRCULAR PathCGFloatradius=imageWidth/2;CGContextBeginPath(context);CGContextAddArc(context,imageCentreX,imageCentreY,radius,0,2*M_PI,0);CGContextClosePath(context);CGContextClip(context);// Draw the IMAGECGRectmyRect=CGRectMake(0,0,imageWidth,imageHeight);[imagedrawInRect:myRect];UIImage*newImage=UIGraphicsGetImageFromCurrentImageContext();UIGraphicsEndImageContext();returnnewImage;}