imagemagickimagemagick-montage

Montage 3 images in a 2x2 grid, first in top center (like "triforce")?


Not sure how to put this question otherwise - but let's assume I have three square images. I'd like to arrange them in a sort of a square 2x2 grid, such that image 2 is bottom left, image 3 is bottom right - and image 1 is top center (so image 1 is not in the cells of the grid on top; neither left cell, nor right cell, but in center of the row delimited by them).

Closest I could get was with this test, done on Ubuntu 14.04, montage --version ImageMagick 6.7.7-10 2017-07-31 Q16:

montage \
  <(convert -size 100x100 xc:green bmp:-) \
  <(montage \
     <(convert -size 100x100 xc:blue bmp:-) \
     <(convert -size 100x100 xc:red  bmp:-) \
     -geometry +5+5 bmp:- \
   ) \
  -geometry +5+5 -tile 1x2 bmp3:- | display

... or as one-liner:

montage <(convert -size 100x100 xc:green bmp:-) <(montage <(convert -size 100x100 xc:blue bmp:-) <(convert -size 100x100 xc:red  bmp:-) -geometry +5+5 bmp:- ) -geometry +5+5 -tile 1x2 bmp3:- | display

The image produced is:

imgck1

What I want instead is something like this (I edited this manually in an image editor):

imgck-edit.png

... that is, somewhat like that old meme Triforce (Wikipedia)

How could I achieve that with ImageMagick's montage?


Solution

  • This might be a case where ImageMagick's "convert" command would serve you better than "montage". Here is an example that should get you pretty much the same result...

    convert -size 100x100 xc:green xc:blue xc:red -bordercolor white -border 5 \
       \( -clone 1,2 +append \) -delete 1,2 -gravity center -append -border 5 out.bmp
    

    Using "convert" can give you more freedom to arrange the images using "+append" and "-append" to attach them, "-gravity" for alignment, and "-border" for spacing.