Node.js Meme Generator that uses Node-Canvas-Prebuilt to render the final image. This is a modified version of Mooslyvania's memecanvas. I made this because I didn't feel like getting all the users of my Discord bot to install Canvas by Automattic, because it requires you to install a lot of dependencies, which is ok I guess, but some people don't want to install a lot of items.
$ npm install memecanvas-prebuilt
Everything should be taken care of...
- init(outputDirectoryName, fileAppendedName)
The outputDirectoryName is where the meme file will be written to on your file system.
fileAppendedName is a string that will be appended to the original file name. eg - if fileAppendedName = '-meme', photo.png will write out to photo-meme.png - generate(file, topText, bottomText, callback)
file is the filename and location - eg. __dirname + 'public/images/photo.png'
topText and bottomText are the text that will be overlayed on the top and bottom of the photo respectively.
callback will return the filename or an error
var memecanvas = require('memecanvas');
memecanvas.init('./tmp', '-meme');
memecanvas.generate('./photo.png', 'Top of Meme', 'Bottom of Meme', function(error, memefilename){
if(error){
console.log(error);
} else {
console.log(memefilename);
}
});