Skip to content

Instantly share code, notes, and snippets.

@fractalglider
Last active June 20, 2016 13:45
Show Gist options
  • Save fractalglider/4f5d0357447bd0acc69ba15e6e6ba6fb to your computer and use it in GitHub Desktop.
Save fractalglider/4f5d0357447bd0acc69ba15e6e6ba6fb to your computer and use it in GitHub Desktop.
A Bash script that generates the fractal glider logo in different sizes.
#!/bin/bash
convert -size 1x1 xc:none background.0.gif
convert -size 1x1 xc:black glider.0.gif
# $1 --- background tile
# $2 --- glider tile
# $3 --- output
function make_glider {
montage $1 $1 $1 $1 \
$1 $1 $2 $1 \
$1 $1 $1 $2 \
$1 $2 $2 $2 \
-background none -tile 4x4 -geometry +0+0 $3
}
for i in {0..3}
do
next=$((i+1))
make_glider "background.$i.gif" "glider.$i.gif" "glider.$next.gif"
convert "background.$i.gif" -scale 400% "background.$next.gif"
done
rm background.*.gif
convert glider.*.gif -trim +repage -bordercolor none -border 10x10 glider.%d.gif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment