Easy:

http://www.imagemagick.org/script/montage.php


Here is a good page on the usage:

http://www.imagemagick.org/Usage/montage/