Google PageSpeed reported that the JPEG images of a web project I recently worked on should be optimized i.e. compressed. So, I used jpegoptim in batch mode on OS X for the job. You need to build the jpegoptim binary for OS X yourself. Short manual:
- Download jpegoptim sources from developer’s website
- Unpack the TAR ball
- Navigate to the unpacked sources in a shell
chmod a+x configure
In my case the libjpeg library was missing. I had to download and build libjpeg as part of the official IJG JPEG 8 code. Once everything was in place I simply ran jpegoptim from the command line for all JPEG files in a folder.
jpegoptim -o --dest=./compressed --strip-all *.jpg
This optimizes all .jpg files in the current folder with maximum compression (–strip-all) and saves the compressed files in the ‘compressed’ sub folder (had to be created first).