Easiest way to join a lot of image tiles

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
rowan.bradley
Posts: 1
Joined: 2012-01-22T17:57:55-07:00
Authentication code: 8675308

Easiest way to join a lot of image tiles

Post by rowan.bradley »

I need to do something conceptually very simple but extremely tedious to do by hand. I need to join together a large number of 256 pixel square JPG image "tiles" into a single large rectangular image. There's nothing complicated about the joining. The images are on a square grid. They need to be joined edge-to-edge, not overlapping but with no gap between them.

I'm sure ImageMagick can do this, but I have spent a couple of hours reading the documentation, and am overwhelmed by the facilities available, and can't pick out just the few commands that I need. Also, I think I will probably need to use one of the language APIs to do what I want. I need to be able to loop over the tiles in a column, generating the correct filename for each tile and joining them together, and outside this I need to be able to loop over the columns, running the inner loop and then joining the columns together. This sounds quite difficult in a batch file. My instinct suggested try PHP since I'm reasonably competent in PHP, but the Imagick module doesn't seem to have a Windows binary but needs building from source. The "quick and simple" procedure for doing this seemed to consist of about 15 pages of detailed instructions for doing things I have never done before. I can imagine it will take me days if not weeks just to master the building of Imagick. I just don't have the time for this.

Can someone suggest a simpler way for me to achieve what I need?

Many thanks - Rowan
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Easiest way to join a lot of image tiles

Post by anthony »

montage will join tiles with a grid layout. Just set -geometry 0 -tile Nx (where N is the number of tile across) no other options needed.

Code: Select all

montage tiles_*.jpg -geometry 0 -tile 10x  result.jpg
An alternative to -geometry 0 is -mode concatenate (they mean the same thing).

For one example see...
IM Examples, Cutting and Borders, Tile Cropping
http://www.imagemagick.org/Usage/crop/#crop_tile

Also Montage Concatenation mode
http://www.imagemagick.org/Usage/montage/#concatenate

The alternative is to read N times at a time and +append them into rows, then -append all the rows. See Layering Images, Append
http://www.imagemagick.org/Usage/layers/#append

Or using some other multi image laying method, but these are much more work.

In future versions of IM (version 7 at some point) I hope to add different and easy image layout operators.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply