1//Install
2npm install imaginary --save
3
4//Import
5var fs = require('fs')
6var imaginary = require('imaginary')
7var serverUrl = 'localhost:8080'
8
9imaginary('myImage.jpg')
10 .server(serverUrl)
11 .watermark({ text: 'copyright' })
12 .on('error', function (err) {
13 console.error('Cannot resize the image:', err)
14 })
15 .pipe(fs.createWriteStream('markedImage.jpg'))
16