Comments (5)
Hey. I tested this with a generator and seems to work fine. The caveat Is that for large frames, or a big number of them, it seems that memory keeps growing. It may be due to how the garbage collector works, but that's outside the scope of the issue.
In terms of usability, it works pretty well. I have to test it with arrays as well, but I'm positive it will work.
from gif.
Hi antonimmo,
Thanks for your interest in gif
and for experimenting on an improvement! Generators are a nice idea, but I'm not sure they're well suited for this specific function...
gif
frames are created by the @gif.frame
decorator which saves everything into an io.BytesIO()
buffer. If memory is a concern, then you might perhaps write each frame to disk (in a temporary folder), loop through and read each using a generator, save, and then delete the temporary folder.
from gif.
So if the io.BytesIO()
keeps using memory until completion, what's the difference with loading temporary frames (as you suggest) it the buffer will grow anyway?
from gif.
Options:
- Keep in memory - faster, but could bump up against memory constraints (unlikely? most computers are 8GB RAM?)
- Write to disk - slower, but would eliminate potential memory issues
I thinkgif
should remain in Option 1. However, if you (or someone else) would like to submit a PR so that users could choose either option implementation (maybe as a global setting?), I would be receptive!
But closing for now...
from gif.
Well, I'm working with such big images in a 64 GB RAM computer, but ran out of memory. This is why I raised this issue in the first place.
I'll do my best to follow your advice and attempt to include the option to save to file. Though, I believe this cannot be done, as it would face similar issues that generators do.
from gif.
Related Issues (9)
- More Examples 💪
- Duration parameter has no effect HOT 3
- AttributeError: partially initialized module 'gif' has no attribute 'options' (most likely due to a circular import) HOT 1
- Size optimization idea HOT 2
- Issues with decorated function arguments used for conditionals, and non-looping gifs HOT 5
- Is there a way to stop the gif after one iteration? HOT 4
- Consider using an image object HOT 1
- Compatibility with plotly HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gif.