I am trying to pipe 5 specific JPG file names into an animated GIF. I have looked through several libraries and found Gif-Encoder. I am not very good with streams. I cannot seem to figure out how to pipe the RGB result from the JPEG Decoder into the addFrame() method of the encoder.
function createAnimatedGif(jpgPaths, animatedGifPath) {
let encoder = new GifEncoder(1280, 720);
let writeStream = fs.createWriteStream(animatedGifPath);
encoder.pipe(writeStream);
encoder.writeHeader();
jpgPaths.forEach(filePath => {
fs.createReadStream(filePath)
.pipe(new JPEGDecoder)
//.pipe(encoder);
//.pipe(pixels => encoder.addFrame(pixels));
});
encoder.finish();
}
via wayofthefuture
No comments:
Post a Comment