Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why do .png backgrounds appear black on iPhone device but not simulator?

I started with a .tiff file and used GraphicConverter to change it to a .png and set a transparency color. Worked fine in the simulator but when I pushed to the device the transparency color became black. Tested with a .png I downloaded from the net and that worked fine, so it seems to only happen with some files. Thus I suspect it has something to do with the way GraphicConverter writes the .pngs, but I don't know enough about file formats to debug it. Any ideas/suggestions? Ideally I'd like to programatically treat all .pngs because my app allowed dynamic loading of arbitrary files, so I can't verify the transparency beforehand.

like image 956
Jon Wood Avatar asked Nov 25 '25 21:11

Jon Wood


1 Answers

PNGs, like most other image formats that support transparency, seem to have multiple ways to handle the alpha channel. Apple recommends the PNG-24 format; perhaps GraphicsConverter gave something else?

You can use Preview to convert your image files. The iPhone should like it better. Just open your file and Save As.

like image 69
zneak Avatar answered Nov 28 '25 17:11

zneak



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!