Giter Club home page Giter Club logo

Comments (5)

antonimmo avatar antonimmo commented on May 18, 2024

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.

maxhumber avatar maxhumber commented on May 18, 2024

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.

antonimmo avatar antonimmo commented on May 18, 2024

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.

maxhumber avatar maxhumber commented on May 18, 2024

Options:

  1. Keep in memory - faster, but could bump up against memory constraints (unlikely? most computers are 8GB RAM?)
  2. 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.

antonimmo avatar antonimmo commented on May 18, 2024

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)

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.