Page 1 of 1

merge few files with montage closer together

Posted: 2009-11-26T09:33:59-07:00
by shw
I have several files which I would like to merge into one file. I use this command to do this:

Code: Select all

montage -gravity northwest -background none file_*.png output.png
I use it for several files but always those which I try to merge are the same size. The problem is - they are merged but they are merged into grid of 128x126px. They are always smaller (the largest ones are 90x120px) so a lot of the space is wasted. Is it possible for them to be merged closer together? So that montage would read size of the first file and use its width and height instead of "hard-coded" 128x126px?

Also I found that then there are less than with 5 or 6 files being merged it creates file with 3 images horizontally and 2 vertically but when I merge 10 files the output file has 4 images horizontally and 3 vertically. I guess there's an algorithm that chooses the best distribution, but question is - the best distribution for what?

Re: merge few files with montage closer together

Posted: 2009-11-26T17:30:37-07:00
by anthony
See IM Examples Montage...
http://www.imagemagick.org/Usage/montage/

the fit setting -geometry controls the distance and resize handling of montage. For example
-geometry '1x1+2+2<'
will separate images by 2 pixel, and turn off image resizing completely. It is the largest dimensions of input images will set the tile size, on a per page basis