Skip to content

Instantly share code, notes, and snippets.

@hellocatfood
Last active August 29, 2015 14:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hellocatfood/083c13e871623cc9cb18 to your computer and use it in GitHub Desktop.
Save hellocatfood/083c13e871623cc9cb18 to your computer and use it in GitHub Desktop.
Emojify an image
#!/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