Skip to content

Instantly share code, notes, and snippets.

@D3f0
Last active June 2, 2016 15:44
Show Gist options
  • Save D3f0/2392c3810fd1879a4b244d70580aba8a to your computer and use it in GitHub Desktop.
Save D3f0/2392c3810fd1879a4b244d70580aba8a to your computer and use it in GitHub Desktop.
Convertir GIF a archivos PNG comprimidos (para mayor desempeño de KIVY)
#!/bin/bash
# Uso: gif2pngzip.sh ARCHIVO.GIF [ARCHIVO2.GIF]
if ! which convert 1>/dev/null 2>/dev/null; then
echo "Falta instalar imagemagick"
exit 1
fi
for archivo in $@; do
if [ ! -f $archivo ]; then
echo "$archivo no es un archivo!"
fi
temporal=$(mktemp -d)
echo "Guardando cuadros temporalmente en $temporal"
convert $archivo $temporal/frame.png
count=$(ls $temporal/*.png | wc -l)
filename=$(basename "$archivo")
extension="${filename##*.}"
filename="${filename%.*}"
target="$filename.zip"
zip -j $target $temporal/*.png
echo "ZIP $target generado con $count imagenes"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment