fix: Add check for whether a WebP file is animated (cwebp does not support compressing animated files)

This commit is contained in:
Carlos Solís 2025-01-29 15:55:19 +00:00
parent badc0d824f
commit 164641f5f7

View file

@ -28,6 +28,9 @@ loop_1(){
then
nice -n 10 oxipng -o max "${p}" #&> /dev/null
elif [[ "${p}" =~ .webp ]]
then
#If file is not animated
if [[ $(grep -v -q -e "ANIM" -e "ANMF" "${p}" ]]
then
nice -n 10 cwebp -mt -af -quiet "${p}" -o /tmp/temp.webp #&> /dev/null
if [[ -f /tmp/temp.webp ]]
@ -42,6 +45,7 @@ loop_1(){
fi
fi
fi
fi
}
cd "${folder}" || exit