Game Development Reference
Note Color depth, bit depth, or bits per pixel is the number of bits that are
stored to represent a pixel's color information. A color depth of 4 bits allows
each pixel in the image to have one of 16 possible colors. With a color depth of
16 bits, an image's pixel can display a range of 65,536 colors. And with a 24-bit
color depth it can have millions of colors—so many, in fact, that an image with
24-bit color depth is sometimes referred to as a true-color image. Why is this
format commonly referred to as 32-bit? Because the additional 8 bits in the
most common file formats are used to store the opacity of each pixel.
I encourage you to read the Wikipedia articles on color depth ( ht-
how computing devices display color.
When using the PVR format, you should also enable the Premultiply alpha check box
to avoid dark borders around sprites in some cases. In your project's app delegate, after
cocos2d has been initialized and shortly before running the first scene, you should also
let cocos2d know that your PVR images uses premultiplied alpha. In cocos2d project
templates this is already set in the AppDelegate.m file.
// Enable pre multiplied alpha for PVR textures to avoid artifacts
For the Image Format setting, you have a variety of options. The default format is
RGBA8888, which gives the best-looking results. It provides 24-bit color depth and an
8-bit alpha channel. The downside is that it's also the slowest to render, and particu-
larly on 1st- and 2nd-generation devices, falling back to a lower-quality image format
and favoring rendering speed are recommended. However, providing device-specific
variants of texture atlases is cumbersome to work with. You may want to simply render
fewer sprites on older devices or possibly even drop support for those devices altogeth-
The best compromise between quality, memory usage, and rendering speed is provided
by the RGBA4444 format. It uses 4 bits per color and 4 bits for the alpha channel. This
is the most commonly used image format for sprites.
If transparency isn't important to you, and you'd like to have more color variations,
you should use the RGB5551 format, which provides 5 bits per color and only 1 bit for