imagemagickmontage

How can I create an ImageMagick montage without empty space?


I am creating a large number of montages using a set of images.

The way I want the montages arranged is with three images across the top and two images across the bottom. The command I have right now is as follows:

montage logo.png 1430410987_ACR02.png 1430410987_ACR01.png \
        1430410987_LHC1.png 1430410987_LHC_dashboard.png   \
       -mode Concatenate -tile 3x3 1_tile.png

This results in a montage of the appropriate arrangement, but features a large empty region to the right, something I don't want. I note that the width of the empty region is the width of the largest of the images used in the montage.

What should I do to ensure that this large empty region is not created?


Solution

  • Your right in identifying the empty region having the same width of the largest image. This is caused by -tile 3x3 which assumes 3 images per row. At the bottom of Montage Usage there's a section dedicated to gaps in a montage image, and how it can be controlled with null:. Try the following...

    montage logo.png \
            1430410987_ACR02.png \
            1430410987_ACR01.png \
            1430410987_LHC1.png \
            1430410987_LHC_dashboard.png \
            null: \
            -mode Concatenate \
            -tile 3x3 \
            1_tile.png
    

    Another alternative

    You can also use convert, sub-process & -append to rebuild the tile image one row at a time.

    convert \( logo.png 1430410987_ACR02.png 1430410987_ACR01.png +append \) \
            \( 1430410987_LHC1.png 1430410987_LHC_dashboard.png +append \) \
            -append 1_tile.png