Tuesday, May 31, 2011

Tile Figures with Montage (ImageMagick)

Suppose you have several figures for articles ,papers, blogs, or anything else. You want to combine these figures into a bigger frame, and they have gaps between each other. How? I had used Inkscape to import the figures, arrange them, and export the final result. No, don't do that again. It is not necessary to launch your image editors with GUI to accomplish this kind of work. I found the most convenient  way is to use some commands offered by the magic ImageMagick.

Good examples have been given in ``ImageMagick v6 Examples -- Montage, Arrays of Images,'' and the following is my own test with some notes.

Now I have four pictures:

002_namie.jpg
008_janine.jpg
009_color.png
010_color.png
Command:
$ montage *_* -geometry 120x120 tile01.png

Output:


Command:
$ montage *_* -geometry 120x120+5+5 tile02.png

Output:


Command:
montage *_* -tile 1x4 -geometry 120x120 tile03.png

Output:
Command:
montage *_* -tile 4x1 -geometry 120x120 tile04.png


Output:

Note:
  • The ``*_*'' is the regexp shorthand of the original files to be combined.
  • The final term of the command is the file name of output.
  • The 120x120 option resizes the output
  • The +5+5 option add gaps between each picture in x then y directions.
  • If only one value is given (+5, for example), then only the x gap is set.
  • Montage arrange the output in array automatically, but you can change it by the -tile option.

No comments:

Post a Comment