36.11 Combine Images

In this example we take two images from the internet, generate an arrow image and then combine all three into one image with an arrow between. Various resizing and border placement is done to improve the aesthetics.


$ wget -O img1.jpg \
  https://www.goodfreephotos.com/cache/australia/south-australia/adelaide/\
adelaide-northern-terrace-in-1839-southern-australia.jpg

$ wget -O img2.jpg \
  https://www.goodfreephotos.com/albums/australia/south-australia/adelaide/\
north-terrace-of-adelaide-in-1841-in-southern-australia.jpg

$ arrow_head="l -15,-5  +5,+5  -5,+5  +15,-5 z"
$ convert -size 100x30 xc: -draw 'stroke skyblue fill skyblue rectangle 30,14 70,16' \
          -draw "stroke skyblue fill skyblue path 'M 70,15  $arrow_head' " \
      -resize 400% arrow.png

$ convert img1.jpg arrow.png img2.jpg -gravity Center +append \
          -resize 30% -bordercolor White -border 10x10 result.png
$ display result.png

Using imagemagick to append multiple images, including an imagemagick generated arrow, into a single image. {#graphics:fig:imagemagick_append}

The images used here come from https://www.goodfreephotos.com and is under the license.



Your donation will support ongoing availability and give you access to the PDF version of the book. Desktop Survival Guides include Data Science, GNU/Linux, and MLHub. Books available on Amazon include Data Mining with Rattle and Essentials of Data Science. Popular open source software includes rattle, wajig, and mlhub. Hosted by Togaware, a pioneer of free and open source software since 1984. Copyright © 1995-2021 Graham.Williams@togaware.com Creative Commons Attribution-ShareAlike 4.0.