pie3636
pie3636

Reputation: 814

ImageMagick : make images of different sizes float to top

I have 7 images that I'm trying to concatenate in a 4x2 tiling. They are all the same width, and have roughly the same height, except one that is about twice higher than the others (4th image). I'm trying to make them tile so that the 4th image covers the space of 2 images in the tiling, but what I get is this :

Get rid of the whitespace

How can I get rid of the whitespace, and make all the images "float" to the top? I don't mind if the bottom images aren't aligned.

Upvotes: 0

Views: 96

Answers (1)

Mark Setchell
Mark Setchell

Reputation: 208077

Personally, I would favour convert over montage for this. All you need to know is that -append appends the second picture below the first and that +append appends the second picture to the right of the first.

So, I effectively put 5 below 1 to make a single taller picture, 6 below 2 to make another single taller picture and then 6 & 2 to the right of 1 & 5 etc and then finally stuff 4 at the end on the right:

convert -background none           \
 \( 1.png 5.png -append \)         \
 \( 2.png 6.png -append \) +append \
 \( 3.png 7.png -append \) +append \
 4.png +append result.png

enter image description here

If you want spacers between your images you can add them in like this:

convert -background none \( 1.png 5.png -append \) xc:none[10x10] +append \( 2.png 6.png -append \) xc:none[10x10] +append \( 3.png 7.png -append \) xc:none[10x10] +append 4.png +append result.png

enter image description here

Upvotes: 2

Related Questions