I ran a speed test on my website recently and found my site too slow in loading images. Never thought the size or the format of the images would matter so much.

Thanks to this post for giving me the idea of using our good old Imagemagik command :

mogrify -resize 1024x768 -quality 85 *.jpg

And then I decided to convert them to ‘webp’ and finally stripping the metadata to further decrease the file size.

mogrify -format webp *.jpg
mogrify -strip *.jpg

All these brought my img directory’s file size from 30 Mb to just 1.2 Mb.