Skip to content

[FR] Jimp node #1

@M0ebiu5

Description

@M0ebiu5

@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

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions