imageflow
imageflow copied to clipboard
Lost animation when converting from GIF to WebP
Using library to reduce incoming images size. Converting incoming GIFs to WebP removes animation.
Used code:
public async Task<MemoryStream> ConvertStreamAsync(Stream input, CancellationToken cancellationToken)
{
Log.Debug("Converting image stream");
using var imagesProcessor = new ImageJob();
var output = new MemoryStream();
await imagesProcessor
.Decode(input, false)
.EncodeToStream(output, false, new WebPLosslessEncoder())
.Finish()
.WithCancellationToken(cancellationToken)
.InProcessAsync();
output.Position = 0;
Log.Debug("Done converting image stream");
return output;
}
input stream can contain JPEG, PNG, WebP and GIF
It also increased in size

I'm not sure we support animated WebP at this time, but I will see what I can do.