Skip to content

Instantly share code, notes, and snippets.

@Wikinaut
Last active June 1, 2018 18:29
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 Wikinaut/8a31fdafd024e7c64074 to your computer and use it in GitHub Desktop.
Save Wikinaut/8a31fdafd024e7c64074 to your computer and use it in GitHub Desktop.
Make n x m: create an n x m stripe of an image (Linux version)
#! /bin/bash
# LINUX convert \( aa.png aa.png aa.png aa.png aa.png +append \) \( aa.png aa.png aa.png aa.png aa.png +append \) -append -gaussian-blur 0.5x0.5 x.png
# call make-nxm <image-filename> rows columms [postfilter-command]
if [ $# -lt 3 ] ; then
echo
echo "Create a composed n x m image from a single image"
echo
echo "Usage: make-nxm image-filename rows colums [postfilter-command]"
echo " default postfilter: -gaussian-blur 0.5x0.5"
echo
echo "Examples: make-nxm img.png 2 4"
echo " make-nxm img.png 2 4 -gaussian-blur 0.5x0.5"
echo
echo " create output image 2x4_img.png"
echo " composed of 2 rows and 4 columns of img.png"
echo " with gaussian blur filter 0.5x0.5 (default filter)"
echo
exit
fi
if [ $# -gt 3 ] ; then
POSTFILTER="$4 $5 $6 $7 $8"
else
POSTFILTER="-gaussian-blur 0.5x0.5"
fi
FILENAME=$1
COLUMNS=$2
ROWS=$3
y=""
row=1; while [ $row -le $ROWS ]; do y="$y $FILENAME "; row=$[$row+1]; done
col=1; while [ $col -le $COLUMNS ]; do z="$z ( $y +append ) "; col=$[$col+1]; done
convert $z -append $POSTFILTER ${COLUMNS}x${ROWS}_${FILENAME}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment