Convert Bitmap to WebP Image?

10,793

Load a WebP image

using (Bitmap image = WebPFormat.LoadFromStream(new FileStream("image.webp", FileMode.Open, FileAccess.Read)))
{
    image.Save("image.png", ImageFormat.Png);
}

Save a WebP image

using (Image image = Image.FromFile("image.jpg"))
{
    Bitmap bitmap = new Bitmap(image);
    WebPFormat.SaveToFile("image.webp", bitmap);
}

For more info take a look here webp

Share:
10,793
Joey Morani
Author by

Joey Morani

Updated on June 04, 2022

Comments

  • Joey Morani
    Joey Morani almost 2 years

    Anyone know if it's possible to convert a Bitmap to a WebP image using C#?

    Been Google-ing around but wasn't able to find anything for C#. I found this: mc-kay/libwebp-sharp · GitHub but it doesn't seem to convert bitmaps to the WebP format.

    Any ideas?