From 1caf2a25905ea25359b71c9db28f039b81fe10e7 Mon Sep 17 00:00:00 2001 From: Hannes Date: Thu, 22 Oct 2026 23:22:35 +0200 Subject: [PATCH] feat: added functions to optimize multiple common image formats --- configs/alias_useful.fish | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/configs/alias_useful.fish b/configs/alias_useful.fish index f1210ca..7379c93 100755 --- a/configs/alias_useful.fish +++ b/configs/alias_useful.fish @@ -379,3 +379,35 @@ function git_cred echo "could not add the credentials helper" 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 \ No newline at end of file