Browse Source

Fix WebP animation speed bug

`Milliseconds` is the milli seconds component of the TimeSpan, `TotalMilliseconds` is the entire TimeSpan expressed as milliseconds.

Example, Timespan of 3.5 seconds:
* `Milliseconds`: 500
* `TotalMilliseconds`: 3500
pull/2624/head
Mark Lagendijk 2 years ago
committed by GitHub
parent
commit
715297c905
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      src/ImageSharp/Formats/Webp/WebpFrameMetadata.cs

2
src/ImageSharp/Formats/Webp/WebpFrameMetadata.cs

@ -48,7 +48,7 @@ public class WebpFrameMetadata : IDeepCloneable
internal static WebpFrameMetadata FromAnimatedMetadata(AnimatedImageFrameMetadata metadata)
=> new()
{
FrameDelay = (uint)metadata.Duration.Milliseconds,
FrameDelay = (uint)metadata.Duration.TotalMilliseconds,
BlendMethod = metadata.BlendMode == FrameBlendMode.Source ? WebpBlendMethod.Source : WebpBlendMethod.Over,
DisposalMethod = metadata.DisposalMode == FrameDisposalMode.RestoreToBackground ? WebpDisposalMethod.RestoreToBackground : WebpDisposalMethod.DoNotDispose
};

Loading…
Cancel
Save