Skip to content

Instantly share code, notes, and snippets.

@kijamve
Last active October 22, 2019 19:06
Show Gist options
  • Save kijamve/c1cf0a72b5930caac5b8a720c7da3912 to your computer and use it in GitHub Desktop.
Save kijamve/c1cf0a72b5930caac5b8a720c7da3912 to your computer and use it in GitHub Desktop.
#!/bin/bash
find . -name '*.jpg' -or -name '*.png' |
while read f; do
ls -l "$f"
ff=$(identify -format "%m" "$f")
if [ $ff = "PNG" ]
then
#optipng "$f"
pngquant -f --speed 1 "$f" --output "$f"
echo "Result post pngquant"
ls -l "$f"
else
if [ $ff = "JPEG" ]
then
jpegoptim "$f"
echo "Result post jpegoptim"
ls -l "$f"
fi
fi
echo "---------------------------------"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment