ios - How to remove the plain background color from an image -


i want clear plain background color image.

for example,

if have picture of person standing in front of green background, want green color removed image.

is there code or api/sdk performs functionality.

any highly appreciated.

@john rogers - i'm getting below error when try running code. doing wrong? enter image description here

uiimage *image = [uiimage imagenamed:@"image.png"];  const cgfloat colormasking[6] = {minred, maxred, mingreen, maxgreen, minblue, maxblue}; image = [uiimage imagewithcgimage: cgimagecreatewithmaskingcolors(image.cgimage, colormasking)]; 

where min begins @ 0 , max begins @ 0. each value number of components in color space of image.