Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Appending images using ImageMagick convert

So I have a bunch of images that I wish to append vertically:

convert *.png -append output.png

However I ran into two problems:

  1. Not all the images are of the same width. Hence images smaller in width than the widest image have white space trailing after them because they are left-aligned.
  2. There's no spacing between the images.

How do you center align all the images and specify spacing between them?

like image 287
Aadit M Shah Avatar asked Dec 13 '25 00:12

Aadit M Shah


1 Answers

Just use ImageMagick's montage utility. Align the images with the -gravity & -extent options, and adjust the spacing with -geometry.

montage fishscales.png circles.png verticalsaw.png \
        -tile 1x -geometry +10+10 \
        -gravity Center -extent 120 \
        out.png

montage example

like image 152
emcconville Avatar answered Dec 17 '25 00:12

emcconville



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!