Tiling/Montaging Huge Images

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
nick18
Posts: 10
Joined: 2018-01-12T20:58:36-07:00
Authentication code: 1152

Tiling/Montaging Huge Images

Post by nick18 »

Platform: Ubuntu 16
ImageMagick Version: 6.7.8-9

I have several large images i need to turn into one gigantic image.

Currently i've been testing the montage command with 4x 40,000 x 40,000 Images tiles in a 2x2 grid (so resulting output is 80,000px square) using the command:

Code: Select all

montage image1.jpg image2.jpg image3.jpg image4.jpg -tile 2x2 -geometry +0+0 tiled_output.jpg
I have 27GB of RAM on the AWS instance i'm working with, and IM seems to top out at 90.6% usage of this with low CPU usage (6-10%). It's been working for about 2 hours now.

Is there a better and faster way to achieve this?

Many thanks for your time
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Tiling/Montaging Huge Images

Post by snibgo »

You don't have enough memory, so IM will cache pixels on disk, which is slow.

Your images are 8 bits/channel, so you don't need Q16 IM. If you are not using Q8, I suggest you do so, as that will halve memory usage.

I expect v7 would be better still, not storing the alpha channel.

More specialist tools may be quicker, eg jpegtran then pnmcat.
snibgo's IM pages: im.snibgo.com
nick18
Posts: 10
Joined: 2018-01-12T20:58:36-07:00
Authentication code: 1152

Re: Tiling/Montaging Huge Images

Post by nick18 »

Thank you very much! I'll test out these options and update with further details.
Post Reply