Create Montages and Proof Sheets from the Command Line in Linux

Spread the love

ImageMagick is a suite of tools for Linux which allows you to manipulate images from the command line. The “convert” command allows you to perform image conversions and image transformations, and you can use the “identify” command to view the Exif data in your images. Another tool from the suite is “montage” which allows you to create a montage or proof sheet (or contact sheet) by combining a number of different images, with or without a border or frame.

To create a simple proof sheet, call “montage” with a list of the images to include plus one final filename for the output. For example:

montage img1.jpg img2.jpg img3.jpg mymontage.jpg

This will create a montage called “mymontage.jpg” composed of the files img1.jpg, img2.jpg and img3.jpg.

You can also use wildcards to include all the pictures in a directory or just those matching the wildcard (e.g. “holiday*.jpg”). Here is how to use all the JPEG images in the current directory:

montage *.jpg mymontage.jpg

By default, the “montage” command will try to fit each image into a 120 x 120 thumbnail and then arrange the images (tile them) in the most optimal way. You can override this default and specify a different size for the images. To produce 180×180 thumbnails with 4 pixels on the left and right of each image and 3 pixels below, use:

montage -geometry 180x180+4+3 *.jpg mymontage.jpg

Note that because the +4 specifies how many pixels are on the left and right of each image, it means that the first thumbnail will be 4 pixels from the left of the contact sheet but the gap between the images will be 8 pixels, 4 on the right of the first image plus 4 on the left of the next image and so on.

To add a frame to each of the images, use the “-frame” option. This option also needs a parameter to define how large the frame should be. For instance, “-frame 5” asks for a frame 5 pixels wide:

montage -frame 5 *.jpg mymontage.jpg

You can also add a shadow using the “-shadow” option.

Montage can also produce thumbnails with a Polaroid effect. In essence, the thumbnail is framed with an off-white border and a curl is added to the image. To try the Polaroid transform, use:

montage +polaroid *.jpg mymontage.jpg

Note that the “+polaroid” option starts with a + sign.

This can then lead to some interesting effects. For example if the spacing between the photos is set to a minus number, the thumbnails can be made to overlap. Combined with the Polaroid effect, this can produce some novel output. Try the following:

montage +polaroid -geometry 180x180-10-3 *.jpg mymontage.jpg

Or even:

montage +polaroid -geometry 180x180-50-30 *.jpg mymontage.jpg

Another useful option is “-rotate“. It allows you to specify a rotation for each of the thumbnails. For example, to rotate each picture by 30 degrees, try:

montage -rotate 30 *.jpg mymontage.jpg

It is also possible to set the background color of the montage. The color can be set using a color name (e.g. red, aqua, maroon, green, olive and so on) or using a RGB color number (e.g. #FFFF00 for yellow). The ImageMagick website has a full list of supported color names. To set the background to a pale turquoise, use:

montage -background PaleTurquoise *.jpg mymontage.jpg

You can even use another image as the background. To do this, use “-texture“, for example:

montage -texture bg.jpg *.jpg mymontage.jpg

Where “bg.jpg” is the name of the background image file.

The “montage” command can be used to create some quite complex proof sheets. You can get further tips and tricks on the ImageMagick Montage Examples page.

If you have any questions about using the “montage” command, please ask them in the comments below and we will see if we can help.

Image credit: sunset montage by BigStockPhoto

Subscribe to our newsletter!

Our latest tutorials delivered straight to your inbox

Sign up for all newsletters.
By signing up, you agree to our Privacy Policy and European users agree to the data transfer policy. We will not share your data and you can unsubscribe at any time. Subscribe


Gary Sims

Gary has been a technical writer, author and blogger since 2003. He is an expert in open source systems (including Linux), system administration, system security and networking protocols. He also knows several programming languages, as he was previously a software engineer for 10 years. He has a Bachelor of Science in business information systems from a UK University.

Comments (1)