thedesk/app/node_modules/jimp/example.js

15 lines
344 B
JavaScript
Raw Normal View History

2018-02-19 04:41:25 +11:00
var Jimp = require("jimp");
var url = "https://upload.wikimedia.org/wikipedia/commons/0/01/Bot-Test.jpg";
Jimp.read(url).then(function (image) {
image.greyscale().getBuffer(Jimp.MIME_JPEG, onBuffer);
}).catch(function (err) {
console.error(err);
})
function onBuffer(err, buffer) {
if (err) throw err;
console.log(buffer);
}