[script] resize gif inside zip
This commit is contained in:
parent
cf986d509d
commit
e7b99972b1
23
scripts/resize_gif_zip.sh
Executable file
23
scripts/resize_gif_zip.sh
Executable 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}"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user