Download libwebp dll here. (There are 32-bit and 64-bit formats). Copy dll file to your bin folder (in local path and release folder)
Then, in your project, install Imazen.WebP
Code snippet :
using Imazen.WebP;
string folderPath = "C:/MyImages";
string webpFileName = "image123.webp";
Bitmap mBitmap = new Bitmap(img);
using (var saveImageStream = File.Open(folderPath + webpFileName, FileMode.Create))
{
var encoder = new SimpleEncoder();
encoder.Encode(mBitmap, saveImageStream, 75); // 75 is Image quality
}
Hope this help !