no me acuerdo creo que fixee el script

This commit is contained in:
simio 2025-06-12 08:26:30 -03:00
parent 203a251932
commit 06f862d7c7
2 changed files with 11 additions and 9 deletions

View File

@ -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"

2
.zshrc
View File

@ -89,6 +89,8 @@ source $ZSH/oh-my-zsh.sh
# export MANPATH="/usr/local/man:$MANPATH"
export PATH="$HOME/.local/share/gem/ruby/3.4.0/bin:$PATH"
# You may need to manually set your language environment
# export LANG=en_US.UTF-8