ios - change colors in image objective c -


i have black , white image, change black in blue color , white in yellow color(for example) in objective-c.

how ?

thanks

you can use core image this.

uiimage *bwimage = ... // image somewhere cgimageref bwcgimage = bwimage.cgimage; ciimage *bwciimage = [ciimage imagewithcgimage:bwcgimage];  cifilter *filter = [cifilter filterwithname:@"cihueadjust"];  // change float value here change hue [filter setvalue:[nsnumber numberwithfloat:0.5] forkey: @"inputangle"];   // input black , white image [filter setvalue:bwciimage forkey:kciinputimagekey];  // output filter ciimage *hueimage = [filter valueforkey:kcioutputimagekey];  cicontext *context = [cicontext contextwithoptions:nil];  cgimageref cgimage = [context createcgimage:hueimage                                  fromrect:[hueimage extent]];  uiimage *coloredimage = [uiimage imagewithcgimage:cgimage]; cgimagerelease(cgimage); 

see documentation more info: core image filter reference


Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -