Please note: this blog has been migrated to a new location at https://jakesgordon.com. All new writing will be published over there, existing content has been left here for reference, but will no longer be updated (as of Nov 2023)

Adding pngcrush support to sprite-factory

Mon, May 2, 2011

I just made a minor update (1.0.1) to the sprite-factory gem to add support for reducing the size of the generated output image by using pngcrush. Should be easy enough to use, just pass the :pngcrush argument when you run the script:

sf images/icons --pngcrush

… or when using the library directly from ruby:

SpriteFactory.run!('images/icons', :pngcrush => true)

It has no effect if pngcrush is not available on your system. To install pngcrush for ubuntu:

sudo aptitude install pngcrush

Crush it!