The command-line convert command, which is part of the very powerful ImageMagick image manipulation package, provides a very simple way to stitch together images. This can be done either vertically, using the -append parameter, or horizontally, using the +append parameter.
This can even provide a way to stitch together landscape photographs, to make one panoramic shot.
convert also works on more than two images. The examples below show 3 images pasted together to create the result-sprite png file.
$ convert image1.png image2.png image3.png -append result/result-sprite.png
# Horizontally
# Example (horizontal sprite):
$ convert image1.png image2.png image3.png +append result/result-sprite.png
... can be pasted together into the below one using: