Tiling:
Today I would like to show a simple and quick solution of how to create a tiled figure (in Terminal).
I am writing a paper right now and needed to show 8 related score examples in a single figure:
I tried a number of different solutions (GIMP, Inkscape, Preview, etc) but nothing worked the way I was hoping it to. Imagemagick to the rescue (http://www.imagemagick.org), specifically the montage
option (http://www.imagemagick.org/script/montage.php).
My final, montaged figure looks like this:
And here is the code that made it happen:
montage -pointsize 55 -label 'm.1' m1.png -label 'm.64' m64.png -label 'm.67' m67.png -label 'm.80' m80.png -label 'm.83' m83.png -label 'm.92' m92.png -label 'm.101' m101.png -label 'm.137' m137.png -geometry '1x1+0+0<' -background white montage_score.png
Quick breakdown:
-pointsize
font size to use
-label ‘string’ file.png
set string to be displayed under the file.png
Add as many label/file pairs as you want. montage
takes care of the tiling for you (of course you can set it manually as well if need be).
-geometry
set how the input file will be scaled and spaced
1x1
shrink the image to 1×1 pixels
+0+0
leave a 0 pixel offset around the images
<
NEVER shrink the input images
The <
command overrides the 1x1
command with the side effect that the largest image will be used as the tile size.
-background
set the background colour; putting “none” would be no/transparent background
And finally the output filename.
That’s it. Everything neatly tiled with a minimum of effort. For a detailed overview of the commands and options see: http://www.imagemagick.org/Usage/montage/
Become a Patron!