Stuart and I have just released the source code for our CSS sprite generation tool on Launchpad. It's covered by a BSD license which allows both personal and commercial use. If you've got Bazaar installed you can checkout the remote branch. Alternatively you can download a tzr.gz of the files from the same location.
There isn't any documentation at the moment and there's definately parts of the code I'd like to rework. That's coming in due course, please bear with us.
Checking out the release branch
bzr branch lp:css-sprite-generator/0.1 from the command line.