暗水印(watermark-js-plus)

510 阅读1分钟

安装

# or pnpm or yarn
npm install watermark-js-plus

用法

普通水印

import { Watermark } from 'watermark-js-plus'

const watermark = new Watermark({
  content: 'hello my watermark',
  width: 150,
  height: 150,
  fontSize: "26px",
  fontColor: "#fff",
  onSuccess: () => {
    // success callback
  }
})

watermark.create()

暗水印

import { BlindWatermark } from 'watermark-js-plus'

const watermark = new BlindWatermark({
  content: 'hello my watermark',
  width: 150,
  height: 150,
  fontSize: "26px",
  fontColor: "#fff",
  onSuccess: () => {
    // success callback
  }
})

watermark.create()

解析暗水印

import { BlindWatermark } from 'watermark-js-plus'

BlindWatermark.decode({
  url: uploadFile.url, // image url
  onSuccess: (imageBase64) => {
    // success callback
  }
})
// 在线解析:https://zhensherlock.github.io/watermark-js-plus/zh/guide/custom/decode.html

官方文档

zhensherlock.github.io/watermark-j…