Jimp: How add Watermark ?

Created on 12 Oct 2016  路  3Comments  路  Source: oliver-moran/jimp

Hi how to add watermark using Jimp and please provide example for mask

question

Most helpful comment

Example of adding a watermark:

var p1 = Jimp.read("image.jpg");
var p2 = Jimp.read("watermark.png");

Promise.all([p1, p2]).then(images => {
    images[0].composite(images[1], 0, 0).write("output.png");
});

And an example of a mask (the black pixels of the mask will determine what parts of the original image are masked):

var p1 = Jimp.read("image.jpg");
var p2 = Jimp.read("mask.png");

Promise.all([p1, p2]).then(images => {
    images[0].mask(images[1], 0, 0).write("output.png");
});

All 3 comments

Example of adding a watermark:

var p1 = Jimp.read("image.jpg");
var p2 = Jimp.read("watermark.png");

Promise.all([p1, p2]).then(images => {
    images[0].composite(images[1], 0, 0).write("output.png");
});

And an example of a mask (the black pixels of the mask will determine what parts of the original image are masked):

var p1 = Jimp.read("image.jpg");
var p2 = Jimp.read("mask.png");

Promise.all([p1, p2]).then(images => {
    images[0].mask(images[1], 0, 0).write("output.png");
});

It's not working for me :(

it is working very well to me. Mac

node -v
v8.11.1

jimp
v0.6.1

Was this page helpful?
0 / 5 - 0 ratings

Related issues

alyyousuf7 picture alyyousuf7  路  3Comments

sesirimarco picture sesirimarco  路  3Comments

molipha picture molipha  路  6Comments

maqboolkhan picture maqboolkhan  路  5Comments

SamuelZhaoY picture SamuelZhaoY  路  3Comments