[script] resize gif inside zip

This commit is contained in:
Mathieu Maret 2020-01-29 11:35:51 +01:00
parent cf986d509d
commit e7b99972b1

23
scripts/resize_gif_zip.sh Executable file
View File

@ -0,0 +1,23 @@
#!/bin/bash
set -euo pipefail
FILE_NAME=$1
input=$(mktemp -d)
function finish {
if [[ ! -z "$input" && -e $input ]]; then
echo "removing $input"
rm -rf "$input"
fi
}
trap finish EXIT
unzip "$FILE_NAME" -d "$input"
find "$input" -name "*.gif" -exec gifsicle --batch -i {} -O3 \;
cur=$(pwd)
cd "${input}"
zip -r "${cur}/$FILE_NAME" -- *
cd "${cur}"