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