-(void) Tailoring {
UIImage *oldimage = [UIImage imagenamed:@ "implements the picture that is ready to be cropped. png"];
CGFloat borderw = 2;
CGFloat Imagew = oldImage.size.width + borderw * 2;
CGFloat Imageh = oldImage.size.height + borderw * 2;
Uigraphicsbeginimagecontextwithoptions (Cgsizemake (Imagew, Imageh), NO, 0.0);
Cgcontextref CTX = Uigraphicsgetcurrentcontext ();
Ring
CGFloat CenterX = Imagew * 0.5;
CGFloat centery = Imageh * 0.5;
Cgcontextaddarc (CTX, CenterX, CenterY, CenterX, 0, M_PI * 2, 0);
[[Uicolor Whitecolor] set];
Cgcontextfillpath (CTX);
Cutting
CGFloat radius = oldImage.size.width * 0.5;
Cgcontextaddarc (CTX, CenterX, centery, radius, 0, M_PI * 2, 0);
Cgcontextclip (CTX);
Drawing
[Oldimage Drawinrect:cgrectmake (Borderw, Borderw, OldImage.size.width, OldImage.size.height)];
UIImage *newimage = Uigraphicsgetimagefromcurrentimagecontext ();
Uigraphicsendimagecontext ();
NSData *data = uiimagepngrepresentation (newimage);
[Data writetofile:@ "path/Picture name. png" Atomically:yes];
}
Clipping of iOS pictures