merge few files with montage closer together

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
shw

merge few files with montage closer together

Post 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?
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: merge few files with montage closer together

Post 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
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply