watermark.js leverages canvas pooling so canvases are reused when possible
/**
* Place a watermark
*/
function placeMark(i) {
watermark(['img/shepherd.jpg', 'img/logo.png'])
.image(watermark.image.lowerRight())
.then(function (img) {
var container = document.getElementById('image-' + (i + 1));
container.appendChild(img);
});
}
/**
* Queue up a bunch of async watermark operations
*/
for(var i = 0; i < 9; i++) {
setTimeout((function(index) {
return function() {
placeMark(index);
};
})(i), 10);
}