NB: The chunks that get emitted by your read stream must either by a 1-dimensional bitmap of RGBA
data (either an array or Buffer), or a canvas 2D context.
Example: Streaming API - Reads
You can also use a streaming API to receive data:
const GIFEncoder = require('gifencoder');const { createCanvas } = require('canvas');const fs = require('fs');const encoder = new GIFEncoder(320, 240);// stream the results as they are available into myanimated.gifencoder.createReadStream().pipe(fs.createWriteStream('myanimated.gif'));encoder.start();encoder.setRepeat(0); // 0 for repeat, -1 for no-repeatencoder.setDelay(500); // frame delay in msencoder.
The above code will generate the following animated GIF:
Contributing
gifencoder is an OPEN Open Source Project. This means that:
Individuals making significant and valuable contributions are given commit-access to the project to contribute as they see fit. This project is more like an open wiki than a standard guarded open source project.