ios - changing color from white to transparent - UIImage -


i have image white lines. need change white colors in image transparent. found solutions in obj-c, doesn't work. in image yellow , red colors too.

my code:

   let rawimageref: cgimageref = image.cgimage!      let colormasking: [cgfloat] = [222, 255, 222, 255, 222, 255]     uigraphicsbeginimagecontext(image.size);     let maskedimageref=cgimagecreatewithmaskingcolors(rawimageref, colormasking);     cgcontexttranslatectm(uigraphicsgetcurrentcontext(), 0.0, image.size.height);     cgcontextscalectm(uigraphicsgetcurrentcontext(), 1.0, -1.0);     cgcontextdrawimage(uigraphicsgetcurrentcontext(), cgrectmake(0, 0, image.size.width, image.size.height), maskedimageref);     let result = uigraphicsgetimagefromcurrentimagecontext();     uigraphicsendimagecontext();          self.controlview.image = result! 

but don't see - image clear (probably).

what doing wrong, please? thank you

fixed

added code before create rawimagereg:

image = uiimage(data: uiimagejpegrepresentation(image, 1.0)!)! 

thank you


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -