Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Q: How can I decode a .gif into individual image frames? #9

Closed
ciaranschutte opened this issue Jan 19, 2014 · 2 comments
Closed

Q: How can I decode a .gif into individual image frames? #9

ciaranschutte opened this issue Jan 19, 2014 · 2 comments

Comments

@ciaranschutte
Copy link

I can go from a gif to an array of frame objects.
How can I get an image file of some sort, for example to draw to canvas, from the objects?

@deanm
Copy link
Owner

deanm commented Jan 19, 2014

I am not sure what you mean by "image file", but omggif produces an array of pixels. See the methods like gr.decodeAndBlitFrameRGBA. There is an example in the repository of how to do this with Plask (plask_viewer.js), the idea is similar but the APIs different for .

The basic idea for would be something like:

var imagedata = canvas_context.createImageData(width, height);
gif_reader.decodeAndBlitFrameRGBA(frame_num, imagedata.data);
canvas_context.putImageData(imagedata, 0, 0);

@deanm deanm closed this as completed Jan 19, 2014
@ciaranschutte
Copy link
Author

thanks for getting back to me deanm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants