Blind Watermark
Text Blind Watermark
js
import { BlindWatermark } from 'watermark-js-plus' // import watermark plugin
const watermark = new BlindWatermark({
content: 'hello my watermark',
width: 200,
height: 200,
onSuccess: () => {
// success callback
}
})
watermark.create() // add watermark
watermark.destroy() // remove watermark
👉 Add parameters for dark background:fontColor: '#fff'
Multiline Text Blind Watermark
js
import { BlindWatermark } from 'watermark-js-plus' // import watermark plugin
const watermark = new BlindWatermark({
contentType: 'multi-line-text',
content: 'hello my multiline blind watermark',
fontSize: 30,
width: 200,
height: 200,
onSuccess: () => {
// success callback
}
})
watermark.create() // add watermark
watermark.destroy() // remove watermark
👉 Add parameters for dark background:fontColor: '#fff'
Image Blind Watermark
js
import { BlindWatermark } from 'watermark-js-plus' // import watermark plugin
const watermark = new BlindWatermark({
contentType: 'image',
content: 'http://upic-service.test.upcdn.net/uPic/github-JxMIKf.png',
width: 300,
height: 300,
imageWidth: 100, // image width
// imageHeight: 20, // image height
onSuccess: () => {
// success callback
}
})
watermark.create() // add watermark
watermark.destroy() // remove watermark
Rich Text Blind Watermark
js
import { BlindWatermark } from 'watermark-js-plus' // import watermark plugin
const watermark = new BlindWatermark({
contentType: 'rich-text',
content: '<div><span style="color: #f00">good</span> watermark</div>',
width: 300,
height: 300,
onSuccess: () => {
// success callback
}
})
watermark.create() // add watermark
watermark.destroy() // remove watermark
Decode Blind Watermark
js
import { BlindWatermark } from 'watermark-js-plus' // import watermark plugin
BlindWatermark.decode({
compositeOperation: 'overlay',
compositeTimes: 4,
url: uploadFile.url, // image url
onSuccess: (imageBase64) => {
// success callback
}
});