Compress a huge png file for use in an iphone game

I have a background file that I want to use in an iphone game, which currently is 40 MB. This is a .png file, and I would like to compress it to the smallest possible size without loss of quality and without loss of alpha channel. I successfully resized the file in a similar way to a large file, just changing its file type to a .jpg file. However, this image did not have transparency, and as far as I know, you cannot change .png to .jpg without losing transparency. Maybe I'm wrong (and please correct me if I am.) If there is a way to compress this .png file, please explain to me how this is done. Also keep in mind that this is a fairly large file, and it would be preferable to compress it for 5 hours or less, if possible. Thank!

+3
source share
3 answers

Xcode compresses pngs, you should see how much the image is inside the embedded application. You can compress images more than Xcode with ImageOptim , but they display a little slower on the screen, this probably won't be for your background image.

+2
source

How do you build a game? If you use OpenGL directly, and if you are happy with the compression it offers, PVR is a terrific format for much smaller and really fast images.

PVRTC on Wikipedia

As keegan3d said, Xcode re-compresses PNG images using PNGCrush. It reverses the byte order and succeeds alpha. This article explains what happens: iPhone "Optimized" PNG

PNG Xcode , - PNG: PNG iOS

Xcode ( ), , image.png file, : PNG?

... . JPEG PNG ( , ). 40MB . ? 2048 x 2048 , . PVR . PVR , PNG, .

+4

PNG- PNG8 + alpha, ImageAlpha/pngquant.

If your background is mostly flat or monochromatic (not too much blur / gradient) then it will look great like PNG8 + alpha.

You can improve the compressibility of PNG24 + alpha images by adding them in a smart way .

However, the 40MB PNG image is still huge. I would not be surprised if this causes memory problems. Consider splitting it into smaller tiles.

+2
source

All Articles