Place 8000 image on an landscape A2 page

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
mikewilsonuk
Posts: 1
Joined: 2015-07-27T08:24:02-07:00
Authentication code: 1151

Place 8000 image on an landscape A2 page

Post by mikewilsonuk »

Hi, I want to place 8000 images on an A2 landscape page equally spaced (same border around images) to form a grid. I've played around with ImageMagick but can't get close to getting this to work. The original individual images are in 16:9 ratio (1280x720 pixels).

Thanks for any help,

Mike
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Place 8000 image on an landscape A2 page

Post by fmw42 »

Use montage. But be sure you have enough memory to hold all the images. The other approach is to write a script to loop over the images and process them one row and a time using +append and then append all the rows using -append. You will need to use -border to add your border around each image if using append. Montage will add borders automatically.

See also http://www.imagemagick.org/Usage/files/#massive and viewtopic.php?f=4&t=26801

Please always identify your version of IM and platform.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Place 8000 image on an landscape A2 page

Post by snibgo »

A2 paper is 594x420mm. With 8000 images, each one will occupy 31 square mm, or about 1/4 inch square. If your printer is 600 dpi, each image will be about 150x150 pixels. The total image would be about 14,000x10,000 pixels, which isn't horribly large.

The best way is probably to shrink all the images first. Then they can probably be montaged together without causing memory problems.
snibgo's IM pages: im.snibgo.com
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Place 8000 image on an landscape A2 page

Post by fmw42 »

User snibgo has a good point about resizing the images first.

Since your images are large, it is probably better to use mogrify first to do the resizing to a new folder, then cd to that new folder and run montage on the resized images.

see
http://www.imagemagick.org/Usage/basics/#mogrify
http://www.imagemagick.org/Usage/montage/

It is always a good idea to provide your IM version and platform when asking questions, because syntax and especially scripting can be different.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Place 8000 image on an landscape A2 page

Post by snibgo »

As proof of concept, I create 8000 png files and montage them:

Code: Select all

%IM%convert -size 150x150 xc:red -duplicate 7999 i_%%06d.png

%IM%montage i_*.png -tile 100x t.png

%IM%identify t.png

t.png PNG 12800x10080 12800x10080+0+0 8-bit sRGB 2c 50KB 0.000u 0:00.000
The montage took 24 seconds on my laptop, peaking at 3.6 GB of memory.
snibgo's IM pages: im.snibgo.com
Post Reply