I’m drawing an image using rgb pixel data. I need to set transparent background color for that image. What value I can set for alpha to be a transparent image? Or is there any other solution for this?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If I understand what you need, you basically want to turn specific colors on an image transparent. To do that you need to use
getImageDatacheck out mdn for an explanation on pixel manipulation.Heres some sample code
And a working demo
With the above code you could check for fuschia by using
if(r == 255 && g == 0 && b == 255)