Create a photo montage using imagemagick

This is a little bash script I put together to create a photo montage with 5 resized pitures in max 3 rows using imagemagick. The script is run from within the folder I have filled with the JPG images I want to create a montage from.

#!/bin/bashfor image in `ls *.JPG`  do    convert -resize 50x50! $image small-$image  donemontage small-*.JPG -mode Concatenate -tile 5x3 montage_final.jpg

The result file like the one below is saved with the filename montage_final.jpg.
Montage finalOne disadvantage using this technique is that it doesn’t keep the aspect ratio of the pictures.
You find more examples of montage usage by visiting the ImageMagick v6 Examples — Montage, Arrays of Images page.