Home of Ebyan Alvarez-Buylla

Zwoptex Export for Starling and Sparrow with Trim Support

Zwoptex Export for Starling and Sparrow with Trim Support

If you, like me, have been using Zwoptex to create your spritesheets for Starling or Sparrow, you might have noticed a distinct lack of trim support. That is, Zwoptex claims to be trimming your files, but the resulting XML does not include any such trim data. Use the following file to fix this pesky problem:


Replace the file with the same name, located within /Applications/Zwoptex.app/Contents/Resources/ (right click Zwoptex.app > show package contents, or cd into it via Terminal).

Start Zwoptex, or restart it if it was open, and re-publish your sprites. If you take a look at the XML now, you will notice the presence of additional attributes detailing the trim, which were previously absent.


With this file I’ve also taken care of the bug where Zwoptex consistently misnamed your sprite source image to the Zwoptex project file (eg. “sprites.zwd”) instead of the actual source image (eg. “sprites.png”), rendering your XML unusable without a manual edit after a publish.

What’s with the -0’s?

Zwoptex will report that a sprite is trimmed even if no trimming has actually taken place (the source and texture rects are the same size). This means that, if you take a look at the sparrow.coordinatesformat.txt file template, only the {{ if sprite.isTrimmed }} case is ever executed. I have contacted Zwoptex’s author with the request of reporting sprite.isTrimmed only if the sprite was indeed trimmed.