Skip to content

Instantly share code, notes, and snippets.

@richard-to
Created January 22, 2014 07:01
Show Gist options
  • Save richard-to/8554587 to your computer and use it in GitHub Desktop.
Save richard-to/8554587 to your computer and use it in GitHub Desktop.
Simple bash script to apply lossy optimization to jpgs in folder
#!/bin/bash
rm -rf out
mkdir out
for d in $(ls)
do
if [[ $d == *.jpg ]]
then
convert $d "out/$d.png"
optipng "out/$d.png"
convert "out/$d.png" "out/$d"
mogrify -quality 60 "out/$d"
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment