Google PageSpeed requires images to be compressed a little lossy.
This means the visual quality will be a little less, hardly noticeable by visitors. The sizes of the images in Kilobytes will be a lot less. This will which will cause your site to load faster, especially on mobile connections.
We have a script available which you can run as a cron job:
~/bin/image_optimize_lossy.sh
Example cron job:
25 2 * * * flock -n $LOCKDIR/imgopt $HOME/bin/image_optimize_lossy.sh &>>$IMGLOG
The script will make backups of images in ~/backup before changing it.
If you only want to compress lossless, so the image will not change visually only reduce its byte size (but less), you can use the script:
~/bin/image_optimize_lossless.sh