1.0.5 • Published 8 months ago
watermarking v1.0.5
watermarking
Easily add watermarks to your web pages for branding, copyright protection, and content security.
Installation
Using npm:
$ npm install watermarking
Using yarn:
$ yarn add watermarking
Using pnpm:
$ pnpm add watermarking
Usage
Here's a simple example to demonstrate how to use watermarking:
import watermarking from 'watermarking';
// Add text watermark to a specific element
const element = document.getElementById(myElement)
watermarking(element, 'Watermark Text');
// Provide options, see Options
const element = document.getElementById(myElement)
watermarking(element, 'Watermark Text', Options);
// Provide remove watermark
const element = document.getElementById(myElement)
const { removeWatermark } = await watermarking(element, 'Watermark Text', Options);
// use image watermark to element.
const { removeWatermark } = await watermarking(element, './book2.jpg', {
padding: 30,
fontSize: 14,
type: 'image',
width: 50,
height: 50,
opacity: 0.4,
rotation: -30
})
document.getElementById('removeBtn').onclick = removeWatermark
For more detailed usage instructions and customization options, please refer to the Documentation.
Options
interface Options {
fontSize?: number;
fontFamily?: string;
color?: string;
opacity?: number;
padding?: number;
rotation?: number;
width?: number;
height?: number;
type?: 'text' | 'image';
}
License
This project is licensed under the MIT License.