Search code examples
c#iiswebp

How can I convert photos to webp format in ASP.NET Core 7 on Windows Server?


I convert photos to webp format with asp.net core 7 on localhost, but the photos are not converted on windows server

public static void GetWebp(int width, int height, int quality, string fullPath, string webpFile)
            {
                ResizeLayer rL = new(new Size(width, height));
                rL.ResizeMode = ResizeMode.Crop;
                using var webPFileStream = new FileStream(webpFile, FileMode.Create);
                using ImageFactory imageFactory = new ImageFactory(preserveExifData: false);
                imageFactory.Load(fullPath)
                            .Format(new WebPFormat())
                            .Quality(quality)
                            .Resize(rL)
                            .Save(webPFileStream);
            }

Solution

  • you must Install exactly version 3.01 vcredist_x64-Main.exe and vcredist_x86-Main.exe