Skip to content

Instantly share code, notes, and snippets.

@zgulde
Created December 5, 2017 05:32
Show Gist options
  • Save zgulde/7895b69910fd99d300c36e6487e01cf8 to your computer and use it in GitHub Desktop.
Save zgulde/7895b69910fd99d300c36e6487e01cf8 to your computer and use it in GitHub Desktop.
# sudo apt-get install -y imagemagick pngquant
for jpg in $(ls *.JPG) ; do
png=${jpg/%.JPG/.png}
echo "converting and compressing '$jpg' to '$png'..."
convert $jpg -strip -resize 15% $png
echo "optimizing '$png'..."
pngquant --output $png --force --quality 0-25 $png
done
echo '-----------'
echo '> All done!'
echo '-----------'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment