matt-way / gifuct-js

Fastest javascript .GIF decoder/parser
MIT License
431 stars 64 forks source link

Background not removed on first frame #34

Closed nuthinking closed 3 years ago

nuthinking commented 3 years ago

I don't know if this is a problem with the demo code, but if you load the gif https://media0.giphy.com/media/nvKjkfWIl2msw/giphy.gif

into the demo (and you make the canvas background colored), you can see that a frame (the first one) has a white background instead of transparent. In the following video I try a few times to stop at the right frame, at the end I succeed.

https://user-images.githubusercontent.com/163635/115850609-56636880-a426-11eb-9c0d-2d7792dd934b.mp4

In my app which uses the same logic as the demo, when I create a texture for my animation I get indeed the white background on the first frame.

Screenshot 2021-04-23 at 11 24 52

When the gif is loaded in the browser or in Slack, for instance, no frame has white background.

nuthinking commented 3 years ago

This gif is causing an error on my app maybe for other reasons. Something I noticed though, is that unlike other gifs, each parsed frame has an application node:

Screenshot 2021-04-23 at 11 45 09

Not sure if this is helpful.

jeetiss commented 3 years ago

I have some problem here https://github.com/matt-way/gifuct-js/issues/30

and this is ugly fix for that problem, check https://github.com/jeetiss/react-gifs/blob/main/src/parse-generate.js#L16-L28

nuthinking commented 3 years ago

Fixing this also fixed the error in my rendering 🤷‍♂️ Thanks @jeetiss! 🙌

nuthinking commented 3 years ago

Duplicate of #30