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


enter image description here

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:

enter image description here

after crop:

enter image description here

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

Popular posts from this blog

node.js - Bad Request - node js ajax post -

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -