thedesk/app/node_modules/jimp/example.js
2018-02-19 02:41:25 +09:00

15 lines
344 B
JavaScript

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);
}