ImageHelpers.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using SixLabors.ImageSharp;
using SixLabors.ImageSharp.Formats;
using SixLabors.ImageSharp.Formats.Webp;
 
namespace GenXdev.Helpers
{
    public static class ImageHelpers
    {
 
        public static bool ConvertWebPToPng(string webpFilePath, string pngFilePath)
        {
            try
            {
                using (var image = SixLabors.ImageSharp.Image.Load(webpFilePath))
                {
                    image.Save(pngFilePath);
                    //image.Metadata.DecodedImageFormat.
                }
                return true;
            }
            catch (Exception ex)
            {
                Console.WriteLine($"Error converting WebP to PNG: {ex.Message}");
                return false;
            }
        }
    }
}