I am looking for a way to get the transparent pixels in a UIImage, I have googled this but have found little or nothing. Does anyone know how I can do this?
I am looking for the easiest way possible too!
Thanks!
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 you initialize an UIImage with a transparent or semitransparent image form disk, all the pixels that were transparent, still remain transparent. What is it that you actually want to achieve, maybe I’m misunderstanding something.
Anyway, just save a transparent image (PNG would probably be best) to disk, add it to XCode project and then just:
something = [UIImage imageNamed:@"some.png"];Has worked fine for me so far.