Description
Prerequisites
- I have written a descriptive issue title
- I have verified that I am running the latest version of ImageSharp
- I have verified if the problem exist in both
DEBUG
andRELEASE
mode - I have searched open and closed issues to ensure it has not already been reported
ImageSharp version
3.1.8
Other ImageSharp packages and versions
n/a
Environment (Operating system, version and so on)
Windows 11 x64, also reproduced on Amazon Linux x64
.NET Framework version
8
Description
When this .png file is converted to .webp using ImageSharp, it produces a corrupted webp image:
Screenshot of corrupted webp file as viewed in chrome:
I did look at #2068 which seemed like a similar issue but the problem ended up being their environment. In my case, I'm able to reproduce with a minimal reproduction as shown below. I won't rule out that I'm doing something wrong, but I'm not seeing anything and my webp conversion code works beautifully otherwise.
EDIT: I think this is caused by the image having dimensions greater than the max webp supports (16383). So the issue might be more one of argument validation/throwing a clear error message rather than a flaw in the encoding algorithm.
Steps to Reproduce
Repro code:
var path = @"path\to\repro.png";
using var image = SixLabors.ImageSharp.Image.Load(path);
using var outputStream = File.OpenWrite(path + ".webp");
image.Save(outputStream, new WebpEncoder { Quality = 75, Method = WebpEncodingMethod.Fastest, FileFormat = WebpFileFormatType.Lossy });
Images
Input and output files (had to zip since neither would upload directly):