Skip to content

Instantly share code, notes, and snippets.

@eZanmoto
Created March 31, 2016 15:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eZanmoto/5f7884aebe7bb9a45ceae06658e58b2a to your computer and use it in GitHub Desktop.
Save eZanmoto/5f7884aebe7bb9a45ceae06658e58b2a to your computer and use it in GitHub Desktop.
Creates a 3:2 image from 3 square images
#!/bin/bash
# Usage: bash tri-img.sh src1.png src2.png src3.png tgt.png
set -e
DIR=$(mktemp -d -t '')
convert "$1" -resize 240x240 "$DIR"/1.png
convert "$2" -resize 118x118 "$DIR"/2.png
convert "$3" -resize 118x118 "$DIR"/3.png
convert "$DIR"/1.png -size 4x120 xc:white '(' "$DIR"/2.png -size 118x4 xc:white "$DIR"/3.png -append ')' +append -background white $4
@eZanmoto
Copy link
Author

This script requires ImageMagick, and the format of the mktemp command needs to be changed if using Linux. Source images should have even-length sides to avoid white borders in the output image.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment