ImageMagick Tips and Tricks Part II
The ability to combine a set of images into one image in a variety of ways, essentially replicates the contact sheets of old. Here are a few ways to create a montage. It works best when all the images are the same height and width. IM does not understand page sizes, and will just create a simple image, regardless of the number of images, you can tell IM which images to use though. It also makes sense when testing and creating montages to save the output to a different directory, otherwise your montages will be included in the next iteration!
One word of warning along the way, some images will carry with them metadata, which may make creating montages “without” labels a frustrating exercise. I found this to be an issue with png files. You can remove all the metadata using a program called exiftools. Install this on your linux system as follows:
To view information held in a file run:
If you have a directory full of png image files, you can remove the information from all the files with this command:
OK, on to some examples of montage creation:
1. Simple montage of a set of images
(you can use file names if you wish)
2. Simple montage in one row
3. Simple montage in one column
4. Simple montage in 2 columns and 3 rows
As you can see IM is automagically adding a white border. This can all be modified (reminding ourselves of exiftools).
5. Simple montage with no borders
(my images have a black border of 0.5 pixels)
6. Simple montage with a blue border of 4 pixels
(note that you get 4 pixels on the outside border but 8 pixels on the inner!). You can use any colour you like for borders, use hex notation.
7. SImple montage with same width outside border
To get the same width for the outside border, you need to pipe the first command to a second (note the order of bordercolor and border in the convert pipe, it is important!):
8. Simple montage with sized images
(because I am using block colours I’ll use a different height and width for demonstration purposes)
(note the escaped exclamation mark – “\!”, this overcomes the aspect ratio)