Spritesheet Generator

This Adobe AIR app was the first tool I built for KlickNation. It allowed our artists to rapidly convert hundreds of renders to highly compressed spritesheet sets with corresponding XML data that defined the bounds and frames for each set of animations. A spritesheet could be made from one set of images, or several similar sets (one set for each different direction, in our case).

Exported stylesheets are made up of three files: color, alpha, and data. The color file is a JPG image that stores the spritesheet's color information. The spritesheet's alpha information is stored as a greyscale GIF image, with the number of colors equal to the number of alpha levels we need. The data file is stored as XML. It contains enough information to reconstruct the order and uncompressed position of each sprite, along with a little extra information necessary to assist the next tool in our toolchain, the Behavior Tool.

The actual image conversion and generation was accomplished through ImageMagick's command line tools. Jake Gordon's Binary Tree Bin Packing Algorithm allowed for the tight packing of sprites within the spritesheet rectangle. It was originally implemented in Javascript, but I converted it to run natively in Actionscript.

There were some serious limitations that I ran into while creating this app. Adobe AIR would not allow the calling of native executables from the command line without building directly on the platform in question, so I had to borrow a Windows box to make the Windows build. Windows also seems to have a limit to how long a command line instruction can be, even executed programmatically. I attempted to do all sprite positioning and compression in a single step, in memory, to reduce artifacts from repeated file saves. I eventually had to break up the process by exporting temporarily to PNGs if I detected that my command line instruction would be too long.

Features

  • Mac + PC
  • Drag-and-drop import
  • Supports both single and multiple sets of animations
  • Color-coded animation frameset selection
  • Mass edit multiple animation sets
  • Animation set options can be exported and imported
  • Sprites cropped to their minimum opaque bounds
  • Sprites packed tightly to reduce spritesheet size
  • Color and opacity spritesheets exported separately to reduce overall filesize
  • Generated spritesheet can be previewed with different backgrounds
  • Full control over compression quality settings
  • Exported spritesheet size is only limited by standard memory and storage concerns
  • Fully non-modal interface, errors communicated with the top bar

Gallery