Imagemagick: How can I mosaic 9 JPGs into one JPG?

Hello folks,

Wondering if GD or Imagemagick can do this.

I want to take 9 files from my server and create a grid of them, reduced in size to display as a gallery header of sorts for instance:

Is this possible at all?

Many thanks,


Check this page out 2nd from the bottom, the bit of code creates the thumbnail images, adds a frame and shadow, spaces the images and makes an image map - from memory as it was a while ago since I did this :slight_smile:

This reads all the images from the folder to create the “index” or you can add individual images:

exec("/usr/local/bin/montage image1.jpg image2.jpg image3.jpg image4.jpg image5.jpg image6.jpg -tile x3  mosaic/montage.jpg");

I have also done it with php using an array and looping through it.

The code can be modified and there are other methods you could use like -append or just create the images with Imagemagick and locate them on the page with html.

So many choices and options !!

By fixing the thumbnail sizes, and of course with the help of co-ordinates we can do it using GD too. I had done already about it.

Thanks guys, got it all sorted out! :smiley: