Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I would like to combine multiple images into one image using ImageMagick. To explain a little better, I want the result to look similar to this:

enter image description here

That is, I have a number of screen shots, and I want to turn them into one image with the original images on top of each other.

By Googling, I have come across the 'composite' command, but I don't know if, and in that case how to use it to get the result I want.

share|improve this question
    
Did you check out imagemagick multi image layer examples? –  timbooo May 30 '11 at 19:35
add comment

1 Answer

up vote 63 down vote accepted

For any number of single input files named in-<something>.jpg:

convert -append in-*.jpg out.jpg

or

montage -mode concatenate -tile 1x in-*.jpg out.jpg

will both create a file out.jpg that contains a vertical concatenation of the source images.

convert

For simple concatenation in a single row or column, the append option of the convert tool is sufficient. Note that -append concatenates all images vertically, creating one column with n rows and +append concatenates horizontally, creating one row with n columns.

(See ImageMagick: Command-line Options.)

montage

To get finer control over the layout, we would need the montage tool. montage -mode concatenate will glue the input images together like the append option and -tile 1x controls the layout to be applied.

tile follows the format <columns>x<rows>, but either side may be missing and montage will figure out how to meet the constraints.

We're using 1x (exactly one column with any number of rows) here to get the same effect as -append. Without -tile 1x, it would join the images like +append, defaulting to -tile x1 (any number of columns on one row).

(See ImageMagick Examples: Montage, Arrays of Images.)

share|improve this answer
1  
Thanks, exactly what I was looking for! –  Izbitzer May 31 '11 at 12:44
1  
Thanks. append works fine, but I consider montage broken: if ghostscript fonts are not installed, it will bail out, EVEN if you are not annotating the images. Fonts should be loaded on demand, not in advance. –  Bram Jan 5 at 19:26
    
@Bram: I didn't know that and strongly agree. Do you know if GraphicsMagick behaves the same? –  user112553 Jan 6 at 4:00
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.