Skip to content
MagickCmd › ImageMagick combine and append images

ImageMagick combine and append images

Join images side by side or stacked, build a contact sheet with montage, and create before/after comparisons with ImageMagick. Includes spacing and label options.

Stack images vertically or horizontally

magick shot1.png shot2.png shot3.png -append output.png    # vertical
magick before.jpg after.jpg +append comparison.jpg         # horizontal

The minus/plus convention runs right through ImageMagick: -append stacks vertically, +append joins side by side. Generally, minus turns a setting on and plus turns it off or selects the alternate behaviour.

Mismatched sizes

Images of different widths are padded to the widest one with the background colour, not scaled. For a clean strip, normalise them first:

magick shot1.png shot2.png -resize 800x -background white \
  -gravity center -append output.png

Add spacing between images

magick before.jpg after.jpg -background white -splice 20x0 \
  +append -chop 20x0 comparison.jpg

-splice inserts a band of background before each image; the trailing -chop removes the leading one so the gap only appears between them.

Contact sheet with montage

montage *.jpg -tile 4x -geometry 300x300+8+8 \
  -background white -label '%f' sheet.jpg

montage is a separate binary from magick. On ImageMagick 7 you invoke it as magick montage; on IM6 it is just montage.

  • -tile 4x — four columns, as many rows as needed. -tile 4x3 caps it at twelve per sheet.
  • -geometry 300x300+8+8 — cell size plus horizontal and vertical padding.
  • -label '%f' — prints the filename under each thumbnail. Other useful tokens: %wx%h for dimensions, %b for file size.

Contact sheet with a title

montage *.jpg -tile 5x -geometry 240x240+6+6 -background '#111820' \
  -fill white -label '%f' -title 'Shoot — March 2026' sheet.png

Before / after with a divider

magick before.jpg after.jpg -resize x800 \
  -background '#0d9488' -splice 4x0 +append -chop 4x0 out.jpg

Overlay one image on another

For placing rather than tiling, use -composite — covered on the watermark page:

magick background.jpg overlay.png -gravity center -composite out.jpg

Build a sprite sheet

montage icon-*.png -tile 10x -geometry 64x64+0+0 \
  -background none sprite.png

Zero padding and a transparent background give you predictable coordinates for CSS background-position.


Related

Copied