benwiley4000 / gif-frames

🖼 Extract frames from an animated GIF with pure JS
MIT License
167 stars 26 forks source link

How to render frame to img tag if outputType is jpg/jpeg #26

Open JasonBoy opened 3 years ago

JasonBoy commented 3 years ago

if I set outputType to some image instead of canvas, the return value is ContentStream, how Can I use it to render in <img/> tag?

yzevm commented 3 years ago

Hi @JasonBoy I faced with it too, you can try my fork https://github.com/nsfw-filter/gif-frames

I return ImageData https://developer.mozilla.org/en-US/docs/Web/API/ImageData here https://github.com/nsfw-filter/save-pixels/commit/d93d42fdc5dcf7dc4500ea2f2e5c4e7289c27366

How to use for Node.js and Browsers https://github.com/infinitered/nsfwjs#classifygif

nosed07 commented 1 year ago

@YegorZaremba , I was able to install everything as expected. But still I have my doubts how to use the frameData[0].getImage() as src for an tag.

By the way, if I install your fork, it wont pick up gif-frames in var gifFrames = require('gif-frames');

Thanks