Skip to content

Instantly share code, notes, and snippets.

@danyeah
Created December 22, 2015 09:22
Show Gist options
  • Save danyeah/b310920a671a5b8cedbc to your computer and use it in GitHub Desktop.
Save danyeah/b310920a671a5b8cedbc to your computer and use it in GitHub Desktop.
Bulk mozjpeg optimizer
#! /bin/sh
#this is where your files will be put
mkdir originals
# I run mozjpeg for everyfile in this dir, adding the suffix .tmp, and move the original file in /originals
for f in ./*.jpg;
do
mozjpeg -optimize -outfile $f.tmp $f;
mv $f originals/$f;
done
# fir evry .tmp i rename it without the extension,
for f in ./*.tmp;
do
mv $f "${f%.*}"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment