Sprite Factory 1.2.0 Released
Sun, May 8, 2011Announcing the v1.2.0 release of the sprite-factory gem.
It has all the features of the original release, plus a new layout option :packed
which allows you to generate an optimized packed square image instead of just
horizontal or vertical strips.
You can see the difference between this horizontal strip:
and this packed square:
You can use the new option from the command line:
$ sf icons/avatars --layout packed
Or when using the ruby library directly:
require 'sprite_factory'
SpriteFactory.run!('icons/avatars', :layout => :packed)
Finding the optimal packing square for arbitrary sized images is a non trivial problem called bin packing. You can learn more about how the sprite-factory bin packing algorithm works here and find an interactive javascript demo here
Let me know if you have any problems/feedback.
Enjoy!