-
Notifications
You must be signed in to change notification settings - Fork 32
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
Grab first frame more quickly with GIF stream #13
Comments
Should be possible to use this method to get first frame from gif - https://stackoverflow.com/a/4276742/3772379 |
I already have a module I wrote for getting the first frame from a GIF: https://github.com/benwiley4000/gif-frames The problem is that get-pixels doesn't fire its callback until the whole image is loaded. I wanted to stream the first frame then cut off the rest of the stream. Looking at this again I think it's possible with this web-streams-node module which could let me convert that gif-stream into a WHATWG web stream, so I can pipe the |
I've got a proof-of-concept working here: https://codesandbox.io/embed/n15vp7r7wm Need to figure out the best way to add that to the library... preferably not adding on too many kilobytes. It might be best to make it an optional add-on module. |
It might be possible to automatically turn the first GIF frame into a data url with the help of gif-stream and pixel-stream - we could write the image data after the first frame has loaded to a canvas element, maybe with save-pixels, and extract the data url.
The text was updated successfully, but these errors were encountered: