Giter Site home page Giter Site logo

Export JPG/PNG as blob about ccapture.js HOT 2 OPEN

nijk avatar nijk commented on July 19, 2024
Export JPG/PNG as blob

from ccapture.js.

Comments (2)

spite avatar spite commented on July 19, 2024

You can follow the structure defined in CCFrameEncoder (https://github.com/spite/ccapture.js/blob/master/src/CCapture.js#L128) to build your own frame encoder.

Are you storing the frames in memory, sending them to a server...?

from ccapture.js.

nijk avatar nijk commented on July 19, 2024

Thank you. I'll be storing them in memory as some kind of array of blobs. I was planning to pass this array of blobs to the AVI Encoder (a fork of this).

So all I really need to achieve is to obtain the array of blobs from the animation. This is trivial using canvas.toDataURL() & requestAnimationFrame, but doesn't come with the smooth animation timing advantages of CCapture.

I can think of two routes to adding this functionality:

  1. Adding a new Encoder that allows access by the calling code to a blob from each captured frame. Ideally it could be configured to handle the blobs on a per frame basis at the time of capture (via callback or event emit) or access to all frames at the end of the capture via capturer.save() where the data returned is an array of blobs.

  2. I did wonder if it might be possible to achieve this objective more simply by expecting the calling code to use capturer.save(function(blob){ frames.push(blob) }) after the every call to capturer.capture()? I'm guessing the caller would have ensure that they extract only the last item from the array of blobs in this case.

from ccapture.js.

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.