watermark-base64
v1.0.0
Published
watermark base64
Downloads
4
Maintainers
Readme
watermark-base64
Install
npm i watermark-base64
Use
<script type="text/javascript" src="dist/watermark-base64.min.js"></script>
// or
const watermarkBase64 = require('watermark-base64');
// or
import watermarkBase64 from 'watermark-base64';
API
The unique API is: watermarkBase64(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
140
. - height (Number): default is
60
. - color (String): the text color, default is
#666666
. - alpha (Float): the text alpha(0 ~ 1), default is
0.1
. - font (String): the text font style, default is
18px Arial Bold
.
- width (Number): default is
The api return the base64 string of watermark image which can be used in css background / img tag.
watermarkBase64('北鱼游戏 888888');
watermarkBase64('北鱼游戏 888888', { color: '#f6dcd7' });
watermarkBase64('北鱼游戏 888888', { alpha: 0.5 });
Build & Test
npm install
npm run build
npm test