1.0.6 • Published 5 years ago

watermark-image v1.0.6

Weekly downloads
2
License
ISC
Repository
github
Last release
5 years ago

给图片添加水印

watermarkImage

add a watermark in your image and set watermark text style also you can save image with watermark native

Installation

  npm install  watermark-image --save

usage

import WatermarkImg from 'watermark-image';
import exampleImg from './exampleImg';

const canvasEle = document.getElementById('canvas');
const watermarkTxtSty = {
  text:'watermark',
  fillStyle:'rgba(0,0,0,1)',
  fontSize:16,
  watermarkWidth:200,
  watermarkHeight:200
}

this.watermark = new Watermark(canvasEle);
this.watermark.draw(exampleImg, watermarkTxtSty);

// save picture native
this.watermark.save();

// rotation the image
this.rotate();

// reset the watermark style
this.watermark.setOptions(newOpt)

Demo online

https://codesandbox.io/s/jolly-pine-0mygs