imagemagick montage - how to align images to bottom

1k Views Asked by At

I want to create a montage, using ImageMagick, where all the images are aligned to the bottom. The images have different heights, and -gravity South doesn't behave as I expect.

  • Image 1 is 100px high.
  • Image 2 is 200px high.

If I use :

montage *.png -tile 2x1 -background None -geometry +20+0 -gravity South out/montage.png

I get:

enter image description here

If I add a third image, of 50px high, and run

montage *.png -tile 3x1 -geometry +20+0 -gravity South montage2.jpg

I get:

enter image description here

I understand what's happening here - the canvas is expanding from the bottom. Is there any way to get it to grow from the top, so that the image looks like:

enter image description here

1

There are 1 best solutions below

0
Mark Setchell On BEST ANSWER

enter image description here

You can just use +smush (documentation) for that:

convert -background white -gravity south [abc].png +smush 10 result.png

If using Imagemagick v7, replace convert with magick.