Posts Tagged ‘SDK’

Using PVRTC images to keep RAM and bundle size down.

Thursday, March 18th, 2010

The App 3G download limit was recently changed to 20 megs (from 10), but there will still be times when you may find yourself needing to squeeze down that bundle size to make the cut; RAM usage is something you will always want to keep as low as possible.  Thankfully there is something you can do to your app to give you some more breathing room in both departments: use PVRTC images.

PVRTC images use far less ram then .jpg or .png images, support transparency, and compress much better in the bundle.  Unfortunately they are a little unwieldy to use, so I’ve compiled a few tips to help.  Firstly, you can pick up a nice PVRTC image converter in our resource section HERE, which was created during the development of Amazing Ninja Buddy.  This will let you convert your existing images into PVRTC form.  Now, in order to incorporate them into your project I recommend you use Apple’s Texture2D image processing class, or whatever the equivalent is in any of Apple’s newer OpenGL based sample projects.

PVRTC images do have one fatal flaw…they are quite ugly and have a tendency to contain nasty transparency artifacts.  Thankfully there is a good way to to address this:

1) initially have your assets created at double the size you need them at (so for instance 512×512 for a 256×256 desired end result).
2) convert the file to PVRTC
3) draw it in your project at half scale

This will result in images that are very close to the quality of your originals, take up less hard disk space, and use roughly 40% of the RAM…that’s a big difference!