AvaloniaUI/Avalonia.GIF

Loading a GIF via a File or URL stream results in InvalidGifStreamException

kevinta893 opened this issue · 2 comments

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?

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

i fixed it here

if (currentStream.CanSeek)
feel free to comment if it's fixed on your side.