After I was all done porting posts across I plugged my website into Google’s Page Speed Insights to see how my website was fairing.
Desktop speed was looking good.
Mobile…. not so good.
The culprit? Some very large image sizes. Seriously, look at that 1.7 seconds and banner size.
So off I went to find a way to optimise all my images, which led me to optimize-images. A Python module which you can run through the command line. All you have to do is select an image or folder containing images.
pip3 install pillow optimize-images
Choose folder path filling in the blanks after
After that I re-uploaded my now optimised images to GitHub. As you can see the results were pretty good for desktop.
And brilliant for mobile!
So there we have it. Optimising images with Python can be very quick and painless with massive gains for website speed, especially on mobile.