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

Not all gifs are rendered properly #15

Closed
talltyler opened this issue Feb 27, 2016 · 4 comments
Closed

Not all gifs are rendered properly #15

talltyler opened this issue Feb 27, 2016 · 4 comments

Comments

@talltyler
Copy link

About 50% of the gifs that I am looking at seem to be compressed with a standard or a setting that this library isn't supporting, where blocks of color are missing and are rendered transparent.

Here is a screenshot of an example http://i.imgur.com/sgqGaW7.png

I would be happy to help address this issue but I'm not that familiar with the spec to know what needs to be worked on. If you have insights into next steps please let me know.

@deanm
Copy link
Owner

deanm commented Feb 28, 2016

Perhaps you could just attach some GIFs that aren't working properly? 50% seems quite high, perhaps something else is happening

@talltyler
Copy link
Author

I'm pulling gifs from giphy's api
Here is one that renders incorrectly
http://media1.giphy.com/media/l2JJB3GtJDex2DXdC/giphy.gif

and here is one that is working
http://media2.giphy.com/media/l4KibWpBGWchSqCRy/giphy.gif

also to be clear this loading these files, creating a reader, and then decodeAndBlitFrameRGBA to a canvas.

@talltyler
Copy link
Author

I found something. If you pass the same ImageData.data to all of the frames this issue seems to be fixed, but this doesn't work at all for transparent gifs because the prior frames are also visible.

@deanm
Copy link
Owner

deanm commented Feb 28, 2016

This doesn't have to do with omggif, this just has to do with how GIFs work. See the comment:

// From the spec:

And you can read about how disposal works in the spec:

https://www.w3.org/Graphics/GIF/spec-gif89a.txt

But note that most browsers deviate from the spec, and this is one of those cases. I tried to note the behaviour I know about in the source code.

In short: Some frames ask to draw over the previous frame, and some frames ask for the background to be cleared. You can check the disposal from frameInfo() to see what you should do.

In your case it is probably enough just to clear when dispose is 2.

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