graphicsbitmapimagemagickimagemagick-convert

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?


Solution

  • 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