This project has moved. For the latest updates, please go here.

How to combine multiple images (with different sizes) into one?

Jul 29, 2014 at 4:14 PM
Edited Jul 29, 2014 at 4:45 PM
Hi,
Can you please tell me, how to combine multiple images with different sizes into one image? I tried code from documentation and experimented with it for almost one day and I can't figure it out :-/ . My problem is that all images have to be full visible (so not overlapping) and I want no space (or as little as possible) between them. I thought Montage will be good for this and I tried to reach something like #12 in this article: http://www.codersgrid.com/2013/06/07/merge-image-using-imagemagick-montage/ but I can't set tile like this because I can have some bigger images (for example most of them are 40x40 and one will be 1x242 or 242x1).
Thank you for all your responses :-) .
Coordinator
Jul 29, 2014 at 5:12 PM
Edited Jul 29, 2014 at 5:13 PM
There is no build in functionality in montage that does a 'best fit' (http://www.imagemagick.org/Usage/montage/#null, read the remarks). You probably need an algorithm like this 'http://www.codeproject.com/Articles/210979/Fast-optimizing-rectangle-packing-algorithm-for-bu' and create it yourself. It might be a nice feature to add to ImageMagick so I will put it on my TODO list and play with it when I have nothing to do :) (this does not happen that often).
Jul 29, 2014 at 6:37 PM
Thank you for quick response :) . I was afraid there is no way how to do it "simple" but thank you for advice how to start. I started with some simple implementation of basic algorithm with GDI+. When I will implement something more complex I will write you and maybe you will add it to ImageMagick :) .