Skip to content

Instantly share code, notes, and snippets.

@ed-george
Created July 18, 2018 16:01
Show Gist options
  • Save ed-george/d2d8ae365518bb71793cedbfa61bdf30 to your computer and use it in GitHub Desktop.
Save ed-george/d2d8ae365518bb71793cedbfa61bdf30 to your computer and use it in GitHub Desktop.
Create a party gif using a black template image (requires ImageMagick)
#! /bin/bash
# Pass image as first param
IMAGE=$1
# Declare array
declare -a color=("rgb(66,0,69)" "rgb(0,137,60)" "rgb(0,118,137)" "rgb(14,0,49)" "rgb(200,76,23)")
# For each color, create a recolored version of the all black template
for i in "${!color[@]}"; do
printf "Creating image %s\t%s\n" "$i" "${color[$i]}"
convert $IMAGE -fuzz 75% -fill "${color[$i]}" -opaque black "output_$i.png"
done
# Turn it into a gif
convert -loop 0 -delay 10 output_[0-$((${#color[@]} - 1))].png output.gif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment