Git Product home page Git Product logo

Comments (4)

deanm avatar deanm commented on July 22, 2024

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

from omggif.

talltyler avatar talltyler commented on July 22, 2024

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.

from omggif.

talltyler avatar talltyler commented on July 22, 2024

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.

from omggif.

deanm avatar deanm commented on July 22, 2024

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.

from omggif.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.