From 06f862d7c7028d68efcc7cc937580ded91115d40 Mon Sep 17 00:00:00 2001 From: gor_down Date: Thu, 12 Jun 2025 08:26:30 -0300 Subject: [PATCH] no me acuerdo creo que fixee el script --- .local/bin/optimizechar | 18 +++++++++--------- .zshrc | 2 ++ 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/.local/bin/optimizechar b/.local/bin/optimizechar index 4df5396..a7a9f52 100755 --- a/.local/bin/optimizechar +++ b/.local/bin/optimizechar @@ -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" diff --git a/.zshrc b/.zshrc index 5216445..ccb02ea 100644 --- a/.zshrc +++ b/.zshrc @@ -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