Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/xsf0105/water-mask
water-mask, 水印,canvas
https://github.com/xsf0105/water-mask
canvas watermask
Last synced: about 1 month ago
JSON representation
water-mask, 水印,canvas
- Host: GitHub
- URL: https://github.com/xsf0105/water-mask
- Owner: xsf0105
- Created: 2018-07-12T14:03:49.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2018-07-25T03:18:48.000Z (over 6 years ago)
- Last Synced: 2024-04-24T19:47:41.502Z (9 months ago)
- Topics: canvas, watermask
- Language: JavaScript
- Homepage:
- Size: 10.7 KB
- Stars: 0
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# water-mask
> **WaterMask** 是一个使用 canvas 制作的水印图片的 JavaScript 库。
![image](https://raw.githubusercontent.com/allan2coder/water-mask/master/watermask.png)
![image](https://raw.githubusercontent.com/allan2coder/water-mask/master/watermask.png)
![image](https://raw.githubusercontent.com/allan2coder/water-mask/master/watermask.png)### Install
> npm install water-mask
Then import it.
```js
// or
var WaterMask = require('water-mask');
// or
import WaterMask from "water-mask";
```Then use **alimask(text, options)** API.
```js
WaterMask('阿花');WaterMask('阿花', { color: '#f6dcd7' });
WaterMask('阿花', { alpha: 0.5 });
```### API
The API is: **WaterMask(text, options)**.
- **text** (String): required, the text in the watermark image.
- **options** (Object): optional, the options of watermark, with keys below:
- **width** (Number): default is `250`.
- **height** (Number): default is `80`.
- **color** (String): the text color, default is `#ebebeb`.
- **alpha** (Float): the text alpha(0 ~ 1), default is `0.8`.
- **font** (String): the text font style, default is `10px Arial`.
- **groupName** (String): group name.The api return **the base64 string of watermark image** which can be used in css background / img tag.