| At this point, we could export a sprite sheet and property list from TexturePacker for our PhotoshopR bouncing ball animation but it would be a big 4096 kb. Let's take a look at some of the options we have for optimizing the sprite sheet. Let's work our way down the left panel.|
In the Output panel, we can change the default Texture Format setting from PNG to PVR.CCZ. The powerVR graphics format is the best format to use for iOS devices and the PVR.CCZ is a compressed version of this format.
Image Format and Dithering
The default Image Format is RGBA8888 which will give you a good quality image at the expense of file size. We can reduce the Image Format to RGBA4444 with some loss in quality. But we can make up for this loss by using the FloydSteinberg + Alpha Dithering setting. This combination of Image Format and Dithering will give us better results and reduce our files size to 2048 kb.
In the Geometry panel, the Autosize is checked by default. If we uncheck this option the size of our sprite sheet grows to 16384 kb. This Autosize feature tells TexturePacker to use the smallest size possible of the power of 2 for our sprite sheet. We need to keep this featured checked.
Fixed Width and Height
Depending on your target mobile device for your app, you may need to use a specific size for your sprite sheet. Here you have the option to set the width and height of the sprite sheet.
The Scale feature is nice if your target devices are both retina and non-retina display. With this option, you can use the images for the larger resolution device and TexturePacker will create a sprite sheet for each target resolution. Therefore there is no need to resize the larger images for the smaller device in an image editing program.
Algorithm, Trim and Rotation
In the Layout panel, we will use the default MaxRects setting for the Algorithm. MaxRects is the best algorithm especially with the Trim and Allow Rotation options checked. The Trim feature will automatically remove transparent pixels from around your sprites which allows the sprites to be packed closer together in the sprite sheet. The Allow Rotation feature will tell TexturePacker to rotate your sprites whenever it results in closer packing of the sprites.
As you would expect, the less padding used will give a smaller file size. But sometimes it is necessary to use a little padding. If you sprites contain pixels from neighboring sprites, you may wish to add a little padding to prevent this. On the other hand, if the edges of your sprites are being cut off, you may wish to increase the Extrude feature.
If you remember, Photoshop added a solid background to our exported PNGs. We can automatically remove this with the Heuristic Mask option. When we check this option, the individual images in the center panel are stacked into one small image and the colored background changes to transparent and therefore removed. The resulting file size is a small 8 kb.
Once you are ready to export the files, you will set the folder destination for both the Data and Texture files in the Output panel.
Join us in the Flash forum. | Join us in the Digital Art and Design forum.