Last active
August 29, 2015 14:12
-
-
Save hellocatfood/083c13e871623cc9cb18 to your computer and use it in GitHub Desktop.
Emojify an image
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 | |
emojis=(/home/hellocatfood/Desktop/twemoji/16x16/*) | |
# get filename minus extension | |
file=$(basename "$1") | |
filename="${file%.*}" | |
# pick random emoji for gifs | |
file1=$(printf "%s\n" "${emojis[RANDOM % ${#emojis[@]}]}") | |
file2=$(printf "%s\n" "${emojis[RANDOM % ${#emojis[@]}]}") | |
file3=$(printf "%s\n" "${emojis[RANDOM % ${#emojis[@]}]}") | |
file4=$(printf "%s\n" "${emojis[RANDOM % ${#emojis[@]}]}") | |
file5=$(printf "%s\n" "${emojis[RANDOM % ${#emojis[@]}]}") | |
file6=$(printf "%s\n" "${emojis[RANDOM % ${#emojis[@]}]}") | |
# create a temporary gif | |
convert $file1 $file2 $file3 $file4 $file5 $file6 temp.gif | |
# emojify an image | |
convert $1 -colorspace sRGB -scale 10% -scale 1000% temp.gif -virtual-pixel tile -fx 'u[floor(15.999*u.g)+1]' "$filename"_emoji.png |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment