iphone - how to avoid background for an image which is selected from photo gallery or captured from Camera in ios? -

i need selected image without background , trying avoid ground , need selected part should cropped. , how change pixel data on tap selection of image color.
or can this:
before crop:

after crop:

you can allow user draw on image after selection using bezierpath, once have path - can use shapelayer that. like:
cashapelayer *shapelayer = [cashapelayer layer]; shapelayer.path = apath.cgpath; [view.layer setmask:shapelayer];//or make [imageview.layer setmask:shaprelayer]; // , add imageview subview of whichever view want. // draw original image on imageview in case to image,
uigraphicsbeginimagecontext(view.bounds.size); [view.layerrenderincontext:uigraphicsgetcurrentcontext()]; uiimage *image = uigraphicsgetimagefromcurrentimagecontext(); uigraphicsendimagecontext();
Comments
Post a Comment