Loading a GIF via a File or URL stream results in InvalidGifStreamException
kevinta893 opened this issue · 2 comments
kevinta893 commented
Hi,
So I'm trying to load GIF images over URL and File streams and I keep getting InvalidGifStreamException("Not a GIF stream."); exceptions.
Sample code:
var imgStream = File.OpenRead(imageName);
_gifImage.SourceStream = imgStream;
Test GIF
https://github.com/AvaloniaUI/Avalonia.GIF/blob/master/AvaloniaGif.Demo/Images/c-loader.gif
Been Compiling with .NET Core 3.1
Will GIF streams from these sources (and potentially more) be supported?
jmacato commented
You might need to reset the position of the stream when you pass it to GifImage. I'd reckon it'd be at the end of the stream when it's passed from File.OpenRead. Probably this needs to be done in AvaloniaGif's end
jmacato commented
i fixed it here
Avalonia.GIF/AvaloniaGif/GifInstance.cs
Line 48 in 90cc9a3