feat: added functions to optimize multiple common image formats

This commit is contained in:
Hannes committed 2026-10-22 23:22:35 +02:00
1 parent 496fe13c7f
commit 1caf2a2590
1 file changed
+32
+32
View File
@@ -379,3 +379,35 @@ function git_cred
echo "could not add the credentials helper" echo "could not add the credentials helper"
end end
end end
################ Optimize Pictures ##########################################################
function optimize-jpegs
if command -q jpegoptim
find . -type f \( -iname '*.jpg' -o -iname '*.jpeg' -o -iname '*.jpe' \) -exec jpegoptim --strip-none {} +
else
echo "jpegoptim is not installed. Install it with: sudo pacman -S jpegoptim"
end
end
function optimize-pngs
if command -q oxipng
find . -type f -iname '*.png' -exec oxipng {} +
else
echo "oxipng is not installed. Install it with: sudo pacman -S oxipng"
end
end
function optimize-gifs
if command -q gifsicle
find . -type f -iname '*.gif' -exec gifsicle -b -O3 {} +
else
echo "gifsicle is not installed. Install it with: sudo pacman -S gifsicle"
end
end
function optimize-pictures
optimize-jpegs
optimize-pngs
optimize-gifs
end