geebee
geebee

Reputation: 131

transparent color to white for an UIImage

I realised that all my png images are defined with a transparent color instead of white color. I never noticed because the background of my app was white but now is of a different color. And as I cannot edit each single png file to replace the transparent color to white, I am looking for a simple programmatic way of replacing on the fly the transparent color by a white color. How should I do this please?

Thanks for any help

Cheers, geebee

Upvotes: 1

Views: 818

Answers (2)

Jamie
Jamie

Reputation: 5112

If I understand what you're trying to do, I would suggest you add a white background to your UIImageViews.

self.myImageView.backgroundColor = [UIColor whiteColor];

Upvotes: 3

matt
matt

Reputation: 534893

I don't see why you can't just "edit each single png file"; it's a pretty much instant batch operation using GraphicConverter or ImageMagick or whatever.

If you really insist on compensating for this on the device when the image loads, then just draw the image onto a white opaque rectangle and use the resulting composite image.

Upvotes: 2

Related Questions