0.0.2 • Published 2 years ago

npm-watermark v0.0.2

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

watermark

水印添加

Build Status

Installation

Install with npm:

$ npm install npm-watermark

CDN 方式:

  <script src="./dist//watermark_d.js"></script>

Example

 let waterMark = new WaterMark({
    color:'red', //水印颜色
    text:'这是一行字', //水印文字
    //位置 支持topRight、topLeft、bottomRight、bottomLeft、center、topCenter、bottomCenter
    textAlign:'topCenter',
    //相对位置百分百,优先级比textAlign高
    location:['50%','50%'],
    fontSize:30,//字体大小
    img:'https://img2.baidu.com/it/u=3541230664,2664610868&fm=26&fmt=auto' //图片
})

waterMark.imgMark('#img').then((result) => {
    //加水印成功
    document.getElementById('img').setAttribute('src',result)
}).catch((err) => {
    console.log(err)
});

Contact Information

mail: mouhang@sinoiov.com