Combine images on the command line
ImageMagick’s and GraphicMagic’s convert command can be used to combine multiple images into a single larger one.
With the -append flag, the images are combined from top-to-bottom, with +append from left-to-right.
The images can be of different formats.
The output format is inferred from the extension of the out-file.
$ convert A.png B.png C.jpg -append ABC.png

$ convert A.png B.png C.jpg +append A-B-C.png

The -append and +append flags can also be nested to lay out the images in a grid.
$ convert A.png B.png -append \( C.jpg D.jpg -append \) +append AC-BD.png

If the dimensions of the images are not the same, they are expanded to fit using the background color.
$ convert -background "#333333" ABC.png D.jpg +append ABC-D.png
