Code Yarns ‍👨‍💻
Tech BlogPersonal Blog

How to tile images using ImageMagick

📅 2014-Mar-10 ⬩ ✍️ Ashwin Nanjappa ⬩ 🏷️ imagemagick, montage, tile ⬩ 📚 Archive

Tiling images into a 2D grid of one or more rows and columns is an important use of ImageMagick. This operation can be performed using its montage tool.

To tile a set of images, allowing ImageMagick to pick the layout for you:

$ montage *.jpg out.jpg

To tile a set of 7 images, arranged in a single row:

$ montage *.jpg -tile 7x1 out.jpg

To tile a set of 5 images, arranged in a single column:

$ montage *.jpg -tile 1x5 out.jpg

To tile a set of 10 images, arranged in two rows:

$ montage *.jpg -tile 5x2 out.jpg

To specify that only a spacing of 2 pixels be used between images in the above setting:

$ montage *.jpg -tile 5x2 -geometry +2+2 out.jpg

You will notice that montage downsizes images. If you want the resulting image to have the width or height of the original images or a specific width or height, specify it:

$ montage *.jpg -geometry 320x out.jpg

Tried with: ImageMagick 6.8.9.9 and Ubuntu 14.04


© 2023 Ashwin Nanjappa • All writing under CC BY-SA license • 🐘 Mastodon📧 Email