no me acuerdo creo que fixee el script
This commit is contained in:
parent
203a251932
commit
06f862d7c7
@ -19,17 +19,16 @@ downscale_image() {
|
||||
downscale_webp() {
|
||||
local img="$1"
|
||||
local width height
|
||||
dimensions=$(identify -format "%wx%h" "$img")
|
||||
dimensions=$(identify -format "%Wx%H-" "$img")
|
||||
width=$(echo $dimensions | cut -d'x' -f1)
|
||||
height=$(echo $dimensions | cut -d'x' -f2)
|
||||
height=$(echo $dimensions | cut -d'x' -f2 | cut -d'-' -f1)
|
||||
if [ "$width" -gt 960 ] || [ "$height" -gt 544 ]; then
|
||||
gifname="${img}.gif"
|
||||
magick "$img" "$gifname"
|
||||
gifsicle --resize _x544 --colors 256 "$gifname" > "${gifname}s"
|
||||
gifsicle --resize _x544 --colors 256 "$gifname" -o "${gifname}"
|
||||
rm "$img"
|
||||
rm "$gifname"
|
||||
magick "${gifname}s" "$img"
|
||||
rm "${gifname}s"
|
||||
fi
|
||||
}
|
||||
|
||||
@ -149,14 +148,15 @@ find . -type f \( -iname "*.jpg" -o -iname "*.jpeg" -o -iname "*.png" -o -iname
|
||||
# elif [[ "$img" == *".apng" ]]; then
|
||||
# downscale_apng "$img"
|
||||
elif [[ "$img" == *".gif" ]]; then
|
||||
dimensions=$(identify -format "%wx%h" "$img")
|
||||
dimensions=$(identify -format "%Wx%H-" "$img")
|
||||
width=$(echo $dimensions | cut -d'x' -f1)
|
||||
height=$(echo $dimensions | cut -d'x' -f2)
|
||||
height=$(echo $dimensions | cut -d'x' -f2 | cut -d'-' -f1)
|
||||
if [ "$width" -gt 960 ] || [ "$height" -gt 544 ]; then
|
||||
gifsicle --resize _x544 --colors 256 "$img" > "${img}s"
|
||||
rm "$img"
|
||||
mv "${img}s" "$img"
|
||||
gifsicle --resize _x544 --colors 256 "$img" -o "$img"
|
||||
echo "Resized $img"
|
||||
fi
|
||||
gifsicle -O3 "$img" -o "$img"
|
||||
echo "Optimized $img"
|
||||
else
|
||||
# Downscale image if necessary
|
||||
downscale_image "$img"
|
||||
|
Loading…
Reference in New Issue
Block a user