I wanted a quick and efficient way to convert all of my site's images into webp format, but couldn't find anything for Windows that tickled my fancy, so I wrote a quick script to do the heavy lifting for me.
The first thing that you'll want to do is download the webp library from Google. As of the time of writing, the latest version is 1.1.0 and that can be found here. The library is pre-compiled, so you don't have to do anything but download and extract the files from the archive.
The function that I wrote is pretty straightforward. Here is a brief explanation of the command itself & it's input parameters:
Convert-Images <input_directory> <output directory> <quality (0-100)>
Convert-Images "D:/DeleteMe/webp/Originals/" "D:/Projects/Web/Asp.Net/MVC/Umbraco/coderPro.Web.Corp.UI/media" 85
Voila! Just as simple as that all of your old files are converted to WebP and Google PageSpeed Insights will finally shut up. 😁 If you have any questions or need any help with your programming project, please feel free to drop me a line anytime, by using our contact form.
Until next time: