As I plan on implementing sprites on a site I am working on, I didn’t want to have to do all the hard work by hand so I wrote a ruby script to do it. It stitches a directory of png images into a single png file and then returns the sass rules necessary to use them in your markup. (It makes your life a lot easier because you can just keep replacing that whole section of your markup when you change or add an image).
You can get it from my git repository. Feel free to send a patch if it doesn’t do what you want