Sprite Sheet Packer

Sprite Sheet Packer (at codeplex.com) is an excellent little utility for packing all sprites in a single large texture. It is very simple to use, simply add all the files that need to be packed and select destination file path and type. Transparency will be preserved for PNG images. For preventing issues when using mipmaps, you can add the padding around each image.

Final file should look something like this:

The tool will also generate a map file which contains location and size for each image. Two types are supported:

  • TXT exporter: you must read it as a text file and manually parse it. Example file:
    utop_IZ0036 = 0 0 100 100
    utop_IZ0037 = 100 0 100 100
    utop_IZ0038 = 0 100 100 100
    utop_IZ0039 = 100 100 100 100
  • XML exporter: you can add it as a content file to your main project (not your content library project) and use Content.Load<Dictionary> for loading the file’s content.
    <?xml version="1.0" encoding="utf-8" ?>
    <Asset Type="System.Collections.Generic.Dictionary[System.String, Microsoft.Xna.Framework.Rectangle]">
    <Item><Key>utop_IZ0036</Key><Value>0 0 100 100</Value></Item>
    <Item><Key>utop_IZ0037</Key><Value>100 0 100 100</Value></Item>
    <Item><Key>utop_IZ0038</Key><Value>0 100 100 100</Value></Item>
    <Item><Key>utop_IZ0039</Key><Value>100 100 100 100</Value></Item>

    Packing sprites into larger texture increases rendering speed (because texture does not need to be changed for each sprite). The tool is simple to use and easy to integrate into any content pipeline (GUI is merely a front-end for the console application).


About programabilan

Profesionalni programer, amaterski programer...

Posted on January 7, 2012, in Game, Tool and tagged , , . Bookmark the permalink. 2 Comments.

  1. Could you tell me how to get the images in the right order? The images on the sheet seem to be in random order as opposed to how I listed them

    • Hi Anne,

      As I already mentioned, the tool will generate a map file with correct locations and sizes. You can either parse text file or parse/import XML file to get those locations and sizes.

      The order is not preserved, especially if you combine images with the different sizes. Hope this answers your question.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: