-
-
Save leetrout/bcac6548cdec344db2329a55cb1dd922 to your computer and use it in GitHub Desktop.
:something-party: Slack emoji creator, based off alisdair/intensify.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Generate a `:something-party:` Slack emoji, given a reasonable image | |
# input. I recommend grabbing an emoji from https://emojipedia.org/ | |
set -euo pipefail | |
if [ $# -eq 0 ]; then | |
echo "Usage: $0 input.png" | |
exit 1 | |
fi | |
input=$1 | |
cd "$(dirname "$input")" | |
filename=$(basename -- "$input") | |
# Scale to 128x128 | |
scaled="${filename%.*}-scaled.png" | |
convert \ | |
-gravity center \ | |
-background none \ | |
-geometry 128x128 \ | |
"$filename" \ | |
"$scaled" | |
# Generate party colored frames | |
party_colors=( | |
"#93fe90" | |
"#96fefd" | |
"#96b9fd" | |
"#cf7cfa" | |
"#ef4cef" | |
"#ef4c97" | |
"#f0596a" | |
"#f0803c" | |
"#f0bb57" | |
"#fad58e" | |
"#c4d58e" | |
) | |
frame="${filename%.*}-frame" | |
for i in ${!party_colors[@]}; do | |
# Tint the image | |
convert "$scaled" -intensity Lightness -colorspace gray -fill "${party_colors[$i]}" -tint 100 "$frame"-"$i".gif | |
done | |
# Combine the frames into a GIF | |
gif="${filename%.*}-party.gif" | |
convert -background none -set dispose Background -delay 1x10 -loop 0 "${frame}"-*.gif "$gif" | |
# Clean up | |
rm "$scaled" "${frame}"-*.gif | |
# We did it y'all | |
echo "Created $gif. Enjoy!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment