Table of Contents

Texture formats

There are different file formats available which can hold your textures. The format you are using can have influence on memory consumption.

Size Limits

Before we look at the actual formats, there is one thing you have to be aware of. Regardless of the file type, the maximum texture size is limited, depending on the device the game is running on. If you load a texture that exceeds this size, the app will crash!

1024 x 1024 2048 x 2048 4096 x 4096
iPhone 2G iPhone 3GS iPhone 4S + 5
iPhone 3G iPhone 4 iPad 2 (since iOS 5.1)
iPad 1 iPad 3 + 4
For the iPod Touch, I couldn't find a definite information for newer generations. However, I know that for iPod Touch 1G + 2G, the limit is 1024 x 1024, all others support at least 2048 x 2048.


Since most textures in 2D games contain an alpha channel, PNG is the most widely used image format for textures, as it provides decent file compression and contains an 8 bit alpha channel. It's also the format that is easiest to use — almost every image editor can read and write PNG format.

It is, however, also the format that takes up the most space in graphics memory.

Graphics Memory

A PNG image stores 4 channels for every pixel: red, green, blue and alpha, each with 8 bit (that makes 256 values per channel). It's easy to calculate how much space a 512×512 pixel texture takes up:

512 x 512 pixels x 4 bytes = 1,048,576 bytes = 1 MB

Quite a lot for such a small texture, right? Beware that PNG's built-in file compression does not help: the image has to be decompressed before OpenGL can handle it.

Nevertheless: if your textures fit into graphics memory with that format — go on and use PNG. Sparrow's sample game PenguFlip, for example, works fine with PNG textures. They are very easy to use and work with, so I recommend sticking to PNG as long as possible.

However, there might come a moment in the development of your game where your memory consumption is higher than what is available on the device.

This is the right time to look at the PVR image format.


The graphics chips of all current iDevices are developed by PowerVR. Those PowerVR chips support a compressed data format that can be decoded on the fly.

Now that's the important part: a PVR texture will take up almost exactly as much space in graphics memory as it does on your hard drive! That's the main difference to PNG textures, and that's the reason why PVR textures are so special.

The downside is that you probably can't display or save that format in the image editor of your choice. You have to use special tools for that.

There's so much to say about PVR textures that I've moved their description to a separate page: → PVR Textures


I don't think I need to tell you much about the JPEG image format. That must be one of the most popular file formats of all times — you'll find it all over the place when you're browsing through the internet, and it's very likely that your collection of family photos is saved in JPEG.

JPEG is a lossy compression format. That means that your images will lose quality when you save them with JPEG (yes, even when you're using the maximum quality setting). In exchange, the compression rate is very good. However, what I said about the PNG format holds true here, too: the GPU doesn't “speak” JPEG, so the images need to be decompressed before being sent to graphics memory.

The main problem with JPEG, though, is that it does not have an alpha channel. For most of the textures in your game, this will be a show-stopper, because it means that you can only save rectangular objects in JPEG format.

For that reason, the recommended way to use compressed, lossy textures on iOS is PVRTC. Not only does it have an alpha channel, but it can be used in its compressed form by the GPU.

Next Section: PVR Textures

  manual/texture_formats.txt · Last modified: 2013/05/30 12:03 by daniel
Powered by DokuWiki