Page 1 of 1

Tiling the plane with a single small image (montage)

Posted: 2014-07-21T07:05:06-07:00
by dargaud
Hello all,
I'm trying to do something simple: tile a large area with a small image.
The following command works for putting together 128x128 tiny 2x2 images in a 256x256 square:

Code: Select all

NB=128; time montage -tile $NBx$NB $( for (( c=1; c<=$((NB*NB)); c++)) ; do echo "Tiny.png" ; done ) -geometry 2x2+0+0 Tiling.png
But it already takes 20 seconds, and raising it to 256 takes a whooping 7 minutes ! Since I want to go higher than that, it's not a good solution.
Anybody can suggest a faster alternative ?
Thanks

Re: Tiling the plane with a single small image (montage)

Posted: 2014-07-21T07:34:05-07:00
by snibgo
Your method is ingenious, but involves reading the same image file 16384 times. It's hard to think of a slower method.

A faster method:

Code: Select all

convert -size 2x2 gradient:red-blue r.png

convert -size 256x256 tile:r.png rt.png
EDIT: I should point out that "-size 256x256" is the number of pixels in the final image, not the number of repetitions. Using "-size 25600x25600" takes 20 seconds.

Re: Tiling the plane with a single small image (montage)

Posted: 2014-07-21T09:14:36-07:00
by dargaud
THanks. I'd indeed searched for the word 'tile' in the documentation and found "-tile", but not "tile:"

Re: Tiling the plane with a single small image (montage)

Posted: 2014-07-21T09:42:49-07:00
by fmw42
see this and the subsequent sections for all the tiling methods. http://www.imagemagick.org/Usage/canvas/#tile