Closed marklagendijk closed 8 months ago
This would be a good one for community contribution. It’s just timespan conversion stuff.
I looked a bit in the codebase to see if would be something that I might be able to do, and I think I stumbled on the bug: https://github.com/SixLabors/ImageSharp/blob/3fd0d70ff599eb905f72781f461818b2cf36f271/src/ImageSharp/Formats/Webp/WebpFrameMetadata.cs#L51
This seems to be a conversion from a Timespan
to an uint
that should contain the duration in milliseconds. It uses .Milliseconds
but should instead use .TotalMilliseconds
.
For a Timespan of 5.5 seconds Milliseconds
would be 500, but TotalMilliseconds
would be 5500.
That'll be it then! My tests all contain sub-second frames so I never picked it up. Thanks for looking! 👍
Prerequisites
DEBUG
andRELEASE
modeImageSharp version
3.1.1
Other ImageSharp packages and versions
ImageSharp.Web 3.1.0
Environment (Operating system, version and so on)
Windows 11
.NET Framework version
.NET 8
Description
When I saw that animated WebP encoding support landed, I started investigating it ASAP. Our websites are full of animated GIF images, if we can automatically convert these to WebP using ImageSharp.Web (with acceptable quality) we can potentially save a lot of bandwidth.
On a first glance the quality seems fine, but there one problem. The animation speed of most images is way too high.
Steps to Reproduce
format=webp
Images
Image (both original GIF and resulting WebP, I used a .zip file because GitHub does not allow uploading WebP): aug_2022.zip