水印图片 JavaScript 生成库 alimask

码农软件 · 软件分类 · 图形/图像处理 · 2019-09-05 16:43:26

软件介绍

alimask

alimask 是一个使用 canvas 生成类似阿里巴巴内部网站水印图片的 JavaScript 库。Online demo here.

1. Install

npm install alimask

Then import it.

<script type="text/javascript" src="dist/alimask.min.js"></script>
// or
var alimask = require('alimask');
// or
import alimask from 'alimask';

Then use alimask(text, options) API.

alimask('王小为(小为) 888888');

alimask('王小为(小为) 888888', { color: '#f6dcd7' });

alimask('小泥巴(小美) 888888', { alpha: 0.5 });

2. API

The unique API is: alimask(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.

The api return the base64 string of watermark image which can be used in css background / img tag.

3. Build & Test

npm install

npm run build

npm test

本文地址:https://codercto.com/soft/d/13943.html

JavaScript DOM编程艺术 (第2版)

JavaScript DOM编程艺术 (第2版)

[英] Jeremy Keith、[加] Jeffrey Sambells / 杨涛、王建桥、杨晓云 等 / 人民邮电出版社 / 2011-4 / 49.00元

JavaScript是Web开发中最重要的一门语言,它强大而优美。无论是桌面开发,还是移动应用。JavaScript都是必须掌握的技术。W3C的DOM标准是开发Web应用的基石。已经得到所有现代浏览器的支持,这使得跨平台Web开发成了一件轻松惬意的事。 本书是超级畅销书的升级版,由倡导Web标准的领军人物执笔,揭示了前端开发的真谛,是学习JavaScript和DOM开发的必读之作。 本......一起来看看 《JavaScript DOM编程艺术 (第2版)》 这本书的介绍吧!

MD5 加密
MD5 加密

MD5 加密工具

Markdown 在线编辑器
Markdown 在线编辑器

Markdown 在线编辑器