ImageMagick photo montage

[Post update] How to easily generate a photo montage from an image collection, in command line (yes, of course in command line)? You’ll have to install ImageMagick, which should be – just saying – the first soft installed on any desktop. It will allow you to perform any kind of image manipulation through command lines. The goal here is to automatically generate a thumbnails gallery from images approximately of the same proportions (for a more balanced render) but various dimensions. 

XFCE_05Install ImageMagick

First step, install ImageMagick (available on all environments):

$ sudo apt-get install imagemagick

You are now able to use the montage command, designed to produce an array of thumbnail images. Let’s start simple:

$ montage [input.ext] [output.Ext]
$ montage input_01.jpg input_02.png input_03.jpg output.jpg

Which could be shortened, if every images of your input folder are to be used:

$ montage *.* montage.jpg

This is the basic manipulation.

Montage Options

You can use IM’s wide range of options to refine your montage, here with examples:

  • -tile 5×2: tiles display, [nb of colums x nb of rows]. If the number of images is superior to the maximum number of tiles available, several montages will be created.
  • -geometry 75×120+2+2: tiles size and margins, [width x height + horizontal margin + vertical margin]. By default tiles are 120×120.
  • -resize 75×120! will resize your images ignoring the aspect ratio
  • -resize 75×120> will only resize the images larger than the input.
  • -resize 75x will resize your image to 75px width preserving ratio.
  • -background “#cecece”: specify background color or transparency
  • -background none: use with a .png output if you don’t wish any background
  • -bordercolor “#dedede”: border color in hexadecimal
  • -border 2 : border width in pixel


Now, two quick examples of these commands: the first one for my occasional discs articles, the second one for a book covers montage which required a different tiling display. In both case I don’t use the -tile option, add one according to your total number of images (-tile 5×2).

# discs
$ montage *.* -geometry 200x200+2+2! -tile 5x2 -background none -border 2 -bordercolor black disc_montage.png
# book covers 
$ montage *.* -geometry 160x240+2+4 -resize 160x240! -tile 5x2 -background black books_montage.jpg



Comments are closed.

Create a free website or blog at

Up ↑