-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
@RafaPolit What do you think about the idea to make a generic jimp node?
I use now a function node to resize images, but maybe a "jimp node" would be helpful for more people...
Here is the sample code:
JIMP.read(msg.payload).then(function(image) {
msg.image.width = image.bitmap.width;
msg.image.height = image.bitmap.height;
image.resize(newwidth,JIMP.AUTO);
image.quality(quality);
msg.image2.width = image.bitmap.width;
msg.image2.height = image.bitmap.height;
image.getBuffer(image.getMIME(), onBuffer);
}).catch(function (err) {
// handle an exception
if (err) throw err;
});
function onBuffer (err, buffer) {
if (err) throw err;
msg.payload = buffer;
node.send(msg);
}
Metadata
Metadata
Assignees
Labels
No labels