This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var GIFEncoder = require('gifencoder'); | |
function createGifEncoder(resolution, response) { | |
var encoder = new GIFEncoder(resolution.x * 32, resolution.y * 32); | |
var stream = encoder.createReadStream(); | |
response.type("gif"); | |
stream.pipe(response); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Whammy = require('node-whammy'), | |
sharp = require('sharp'); | |
function canvasToWebp(canvas, callback) { | |
sharp(canvas.toBuffer()).toFormat(sharp.format.webp).toBuffer(function(e, webpbuffer) { | |
var webpDataURL = 'data:image/webp;base64,' + webpbuffer.toString('base64'); | |
callback(webpDataURL); | |
}); |