Skip to content

Instantly share code, notes, and snippets.

@sehe
Last active October 12, 2015 21:43
Show Gist options
  • Save sehe/631426698af912975c69 to your computer and use it in GitHub Desktop.
Save sehe/631426698af912975c69 to your computer and use it in GitHub Desktop.
#!/bin/bash
# this script requires
# - bash (or similar)
# - wget (or manually download the source images)
# - convert (imagemagick)
# - gifsicle (https://www.lcdf.org/gifsicle/)
wget -c 'https://scontent.cdninstagram.com/hphotos-xfa1/t51.2885-15/s320x320/e35/11248385_991083787599828_642737356_n.jpg'
wget -c http://i.imgur.com/CUhcR.gif
# prepare refp template
convert 11248385_991083787599828_642737356_n.jpg -rotate 268.1 -crop 290x143+25+12 \
-size 68x46 xc:white -alpha set -geometry +131+38 -compose dst_out -composite \
-size 68x44 xc:white -alpha set -geometry +131+99 -compose dst_out -composite \
refp_template.png
# prepare sparkly layers
gifsicle -k256 CUhcR.gif -o simple.gif
gifsicle -U simple.gif -o unopt.gif
#convert unopt.gif -resize 50% interm.gif
convert unopt.gif -resize 98x120 interm.gif
convert interm.gif layer.png
# put layers into the template
for a in layer-*.png
do
convert -page 290x153 -size 290x143 -geometry +0+0 refp_template.png \
-page 98x120+133+41 $a \
-page 290x153 -size 290x143 -geometry +0+0 refp_template.png \
-layers flatten \
-trim \
"mod_$(basename $a .png).gif"
done
# render gif
gifsicle -l -O9 mod_layer-* -o modded.gif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment