Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
kevinta893 opened this issue Sep 21, 2021 · 2 comments

Comments

@kevinta893
Copy link

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?

@kevinta893 kevinta893 changed the title Loading a GIF via a stream results in InvalidGifStreamException Loading a GIF via a File or URL stream results in InvalidGifStreamException Sep 21, 2021
@jmacato
Copy link
Member

jmacato commented Nov 12, 2021

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
Copy link
Member

jmacato commented Apr 26, 2022

i fixed it here

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

@jmacato jmacato closed this as completed Apr 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants