These are two pretty simple bash scripts which are optimizing set of png and jpg/jpeg images located in a folder. Both of the scripts are just replacing the images with the optimized ones.
In order to execute them, download and compile following binaries
In order to execute the scripts, simply use
optimize-jpgs.sh img
and/or optimize-pngs.sh img
where img is the name of the folder the images are located in.