jokymon / gifimage_ext Goto Github PK
View Code? Open in Web Editor NEWThis project forked from nicksandau/gifimage_ext
Extension of the GIFImage library on pygame.org written by Matthew Roe
License: Creative Commons Zero v1.0 Universal
This project forked from nicksandau/gifimage_ext
Extension of the GIFImage library on pygame.org written by Matthew Roe
License: Creative Commons Zero v1.0 Universal
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 :)
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.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.