[SCRIPTS] Add png compression with pndquant

This commit is contained in:
Gregory Trolliet 2022-10-26 18:16:58 +02:00
parent 1d7412d67d
commit 8e817ad10b

View file

@ -28,6 +28,7 @@ thumbnail(){
jpegq=75 jpegq=75
webpq=55 webpq=55
cavifq=35 cavifq=35
pngq="60-90"
# Si une image est un thumbnail on la considère comme déjà bien traitée. # Si une image est un thumbnail on la considère comme déjà bien traitée.
if [[ $2 == *".thumb."* ]]; then if [[ $2 == *".thumb."* ]]; then
@ -56,6 +57,7 @@ thumbnail(){
pngcrush -warn "$2" "$2.tmp" pngcrush -warn "$2" "$2.tmp"
mv -f "$2.tmp" "$2" mv -f "$2.tmp" "$2"
/usr/bin/convert -resize $maxwidth\> "$2" "$thumbname" /usr/bin/convert -resize $maxwidth\> "$2" "$thumbname"
/usr/bin/pngquant --quality=$pngq --skip-if-larger --force --transbug "$thumbname" -o "$thumbname"
/usr/bin/convert -resize $maxwidth\> -quality $webpq "$2" "$thumbwebpname" /usr/bin/convert -resize $maxwidth\> -quality $webpq "$2" "$thumbwebpname"
pngcrush -warn "$thumbname" "$thumbname.tmp" pngcrush -warn "$thumbname" "$thumbname.tmp"
mv -f "$thumbname.tmp" "$thumbname" mv -f "$thumbname.tmp" "$thumbname"