From 5311b5af3ad2e37c0538223f30d55a2830c8a87f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Sol=C3=ADs?= Date: Tue, 25 Feb 2025 11:40:48 -0600 Subject: [PATCH] fix: Add the detector of GIF length to the storage compressor --- friendica-compress-storage.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/friendica-compress-storage.sh b/friendica-compress-storage.sh index c957be3..89f2443 100755 --- a/friendica-compress-storage.sh +++ b/friendica-compress-storage.sh @@ -13,7 +13,8 @@ loop_1() { nice -n 10 gifsicle --batch -O3 --lossy=80 --colors=255 "${p}" #&> /dev/null #Specific compression for large GIF files while [[ $(stat -c%s "${p}" || 0) -ge 512000 ]]; do - nice -n 10 gifsicle "${p}" $(seq -f "#%g" 0 2 99) -O3 --lossy=80 --colors=255 -o "${p}" #&> /dev/null + frameamount=$(($(exiftool -b -FrameCount "${p}" || 1) - 1)) + nice -n 10 gifsicle "${p}" $(seq -f "#%g" 0 2 "${frameamount}") -O3 --lossy=80 --colors=255 -o "${p}" #&> /dev/null done elif [[ "${t}" =~ PNG ]]; then nice -n 10 oxipng -o max "${p}" #&> /dev/null