Last active
August 12, 2016 08:24
-
-
Save eidantoei/6ee518bbda93778b9f9e9c912adeadbf to your computer and use it in GitHub Desktop.
Conert Skype sprite emoticon file to Animated GIF (e.g. /Applications/Skype.app/Contents/Resources/[email protected])
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 | |
set -eo | |
SRC_FILE=$1 | |
SRC_WIDTH=$(echo $(identify -format "%w" ${SRC_FILE})) | |
SRC_HEIGHT=$(echo $(identify -format "%h" ${SRC_FILE})) | |
FRAMES=$(echo "${SRC_HEIGHT}/${SRC_WIDTH}-1" | bc) | |
for i in $(seq 0 ${FRAMES}) | |
do | |
TMP_FILE_PREFIX=$(printf .tmp_%04d ${i}) | |
convert -crop 40x40+0+$((40*${i}))! ${SRC_FILE} ${TMP_FILE_PREFIX}.png | |
sips -s format gif ${TMP_FILE_PREFIX}.png --out "${TMP_FILE_PREFIX}.gif" 1>/dev/null | |
done | |
convert -dispose previous -delay 5 -loop 0 .tmp_*.gif ${SRC_FILE}.gif | |
rm .tmp_*.png .tmp_*.gif |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment