Git Product home page Git Product logo

gifimage_ext's People

Contributors

nicksandau avatar

Stargazers

 avatar

Watchers

 avatar

gifimage_ext's Issues

Won't work with Pillow > 8.4.0

Hi, the library fails as soon as you load an animation with more than 1 frame. This is due to a change introduced in Pillow 9.0.0, namely that, since all frames can have a different palette, then they decided to convert all frames after 0 to RGBA instead of keeping them palettized. Since your code requires calling palette() for every frame, it fails. Can you correct this, or update your doc saying that this library will only work with Pillow up to 8.4.0?

Many thanks in advance :)

O(N^2) to O(N) optimization

Hi, in the code to load all the frames you have a O(N^2) step, where for each frame, you merge together all the previous frames before merging the final one. This is I guess to cope with the fact that GIF frames have transparency.

However, due to the fact that the previous frame is already the result of merging all the frames before, you really only need to merge the current frame with the frame before it. This allows reducing complexity from O(N^2) to O(N).

I was trying to use a gif with 1000 frames (yes it's stupid to have a gif that big, but well...), and I was wondering why the library was seemingly hanging. The faulty part is lines 105-107 in pygame_animatedgif/__init__.py:

                if cons:
                    for i in frames:
                        pi2.blit(i[0], (0,0))

Please replace it by:

                if cons and len(frames) > 0:
                    pi2.blit(frames[-1][0], (0,0))

There is no visible difference, and it works.

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.