Last active
April 21, 2023 14:25
-
-
Save liunian/0434f0319e36623552aee4dd80457f88 to your computer and use it in GitHub Desktop.
optimize images
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env fish | |
# use optipng to optimize png | |
if type -q optipng | |
set pngs (command find . -name "*.png") | |
for i in $pngs | |
# echo $i | |
optipng -strip all $i | |
end | |
else | |
echo "optipng is not installed yet" | |
end | |
# use jpegoptim to optimize jpeg | |
if type -q jpegoptim | |
set jpegs (command find . -name "*.jpeg" -or -name "*.jpg") | |
for i in $jpegs | |
# echo $i | |
jpegoptim -s $i | |
end | |
else | |
echo "jpegoptim is not installed yet" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment