Giter Site home page Giter Site logo

Disposal method 2 not supported about omggif HOT 2 CLOSED

deanm avatar deanm commented on July 20, 2024
Disposal method 2 not supported

from omggif.

Comments (2)

another-pjohnson avatar another-pjohnson commented on July 20, 2024

I have a workaround basically by checking the previous frameInfo disposal value and if it's 2 clear the pixel buffer, however i really should be clearing to the indexed background color palette value rather than just assuming it's 0x00000000. I didn't really see an easy way to get to that with the code.

    var dispose_last_frame = true;
    for(var i = 0; i < gr.numFrames(); ++i) {
        if(dispose_last_frame) {
            pixel_data.fill(0, 'hex');
            console.log('clearing before frame: ' + i)
        }
        dispose_last_frame = (gr.frameInfo(i).disposal == 2)
        gr.decodeAndBlitFrameRGBA(i, pixel_data);
        frame_data.push(Buffer.from(pixel_data));
    }

from omggif.

deanm avatar deanm commented on July 20, 2024

Sorry, maybe it's not clear but decodeAndBlitFrame is not meant to handle the disposal, for example see:

https://github.com/deanm/omggif/blob/master/plask_viewer.js#L30

I should mention, there is sometimes big differences between what the spec said, and what browsers / others did with GIFs over the years. So really there is sort of an unspoken spec of the reality of GIF, I don't remember all the details now but I know there were a lot of things around disposal where basically nobody follows the spec. It could make sense to add a helper method to omggif to get the background RGBA for example, taking care to handle transparent index, etc, there is a little bit of work to do there and deal with the cascade of the local/global palette etc.

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.