memecanvas
v1.0.5
Published
Node.js Meme Generator using Node Canvas
Downloads
11
Maintainers
Readme
memecanvas
Node.js Meme Generator that uses Node-Canvas to render the final image.
To Install
$ npm install memecanvas
Requirements
memecanvas utilizes Automattic's node-canvas module which has some pre-requisites that must be installed on your machine. To find out more please check out their Wiki and then come back here.
API
- 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
Example Uses -
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);
}
});