Compressing images for the web can gain you a lot more web page load speed. There are many ways to achieve this task but I will be focusing on the CLI method.

Requirements: Image Magick Package

If you don’t have the Image Magick Package installed on your system:

#Install it like so

sudo apt-get install imagemagick

#Once you have imagemagick installed, navigate to the folder containing the images to be converted:

cd images

#Then compress them like so:

mogrify -quality 70 image.jpg

#where '70' is the compression percentage level, it can be any value of your choosing, but be careful not to overdo it as image quality might be affected.

For more tips on using this compression tool:

$ man mogrify