jorgebastida/glue — pull request #42 by jdeniau (2012-05-16 11:44:19+00:00)
Title: A new algorithm

Hello,

First of all, I want to thank you for your glue project !
The tool is really nice, the "project" mode is great, the configuration file is a must-have, and the fact that you use optipng just make me love your tool ! :)

I used it for a personnal project and I loved it.
But I have also develop a packing algorithm at my work that, I think, is a little more efficient that the "square" algorithm you use, so I decided to fork your project and to implement it.

You can find the description of the algorithm here : http://www.sitioweb.fr/blog/3-technical/3-sprite-packing-algorithm

I ran some test between the default configuration and the "optimized-square" algorithm ordered by "height", with optipng each time. I test all your sprite in "test_resource" and some sprite I use, and the default algorithm is better only 1 time (5% better). Each other time, my algorithm is 1 to 15% better.

I am not a python developper, so my code may be optimized. I mainly develop in a new file to limit dependency but we can make improvement if you want.

Thanks,
Julien Deniau