imagemagickimage-manipulationmontage

How to improve image output from montage in ImageMagick?


I joined images using montage, but the resolution of the image output is less than that of the image's input.

My image's input have dimensions of 640x480 each

But the output that I get was 256x378

I was searching in the web and couldn't find a solution to improve the output's image quality.

The montage command that I'm using

montage -tile 2x3 1.png 2.png 3.png 4.png 5.png 6.png -resize 1024x1024  montage_png.png

Anyone know how can I get better output resolution?


Solution

  • Suggestion 1

    Try it this way... let montage organise the images into a montage and then pass the result on to convert to do the resizing of the result.

    montage -tile 2x3 1.png 2.png 3.png 4.png 5.png 6.png miff:- | convert miff:- -resize 1024x1024 montage.png
    

    The intermediate image is passed as a MIFF (Magick Image File Format) which preserves all detail and metadata and quality.

    Suggestion 2

    If it is always just 5 or 6 images and not hundreds, you can also do it all in one go with convert like this. All you need to know is that +append joins images in a row and -append joins images in a column. So I am joining 1&2 in a row, 3&4 in a row, 5 & 6 in a row and then putting the three rows in a stack and resizing the result.

    convert [12].png +append \( [34].png +append \) \( [56].png +append \) -append -resize 1024x1024 result.png
    

    enter image description here