You can also try ImageMagic which is great for creating CSS sprites. Some tutorial about it here.
Example (vertical sprite):
convert image1.png image2.png image3.png -append result/result-sprite.png
Example (horizontal sprite):
convert image1.png image2.png image3.png +append result/result-sprite.png