Search code examples
imagegraphicsgraphicsmagick

GraphicsMagick montage with border with rotation


I'm attempting to use GraphicsMagick's montage tool to rotate 2 images, place a border around each one individually and set the background color to blue. However, I can only successfully rotate the image OR set a border, but not both at the same time. Is this per design? or a bug? Or am I just calling it wrong?

Here's the command I'm running

gm montage -background blue -borderwidth 5 -bordercolor white -rotate 15 <input1>.jpg <input2>.jpg <output>.jpg


Solution

  • This is how you could do it with ImageMagick, but GraphicsMagick doesn't, indeed, seem to want to do rotation and borders.

    1.png is a red square

    2.png is a blue square

    { convert -background cyan -bordercolor lime  1.png -rotate 15 -border 5 miff:-; convert -background yellow -bordercolor magenta  2.png -rotate 15 -border 5 miff:-; } | montage -background blue miff:- result.jpg
    

    enter image description here

    Another option for ImageMagick is like this:

    convert -background cyan -bordercolor lime  1.png -rotate 15 -border 5 \( -background yellow -bordercolor magenta  2.png -rotate 15 -border 5 \) +append result.png
    

    enter image description here

    or this:

    convert -background cyan -bordercolor lime  1.png -rotate 15 -border 5 \
     \( -background yellow -bordercolor magenta  2.png -rotate 15 -border 5 \) \
     -append result.png
    

    enter image description here