watermark-image
TypeScript icon, indicating that this package has built-in type declarations

1.0.6 • Public • Published

给图片添加水印

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

Package Sidebar

Install

npm i watermark-image

Weekly Downloads

6

Version

1.0.6

License

ISC

Unpacked Size

21 kB

Total Files

6

Last publish

Collaborators

  • yang03