1.0.8 • Published 2 years ago

text2watermark v1.0.8

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

Node.js 图片添加文字水印库

Installation 安装

$ npm install text2watermark

Demo 例子

const text2watermark = require('text2watermark')
const watermarkBuffer = await = text2watermark.convert(buffer,'测试水印')                 

Features 功能特性

  • 基于images库,实现了添加文字做水印的功能
  • 内置了微软雅黑字体,可以调用时传入其他字库
  • 方便node接口调用,输入输出图像都是Buffer类型

Installation 安装

$ npm install images

API 接口

convert(buffer, text, options, font)

从Buffer数据中解码图像,添加文字水印

:options

配置项非必要

{
    fontSize: 14, 
    path: {'fill': 'black'}, // 文字颜色
    position:{x:10,y:10} // 相对原图右下角位置的偏移
} 

:fontpath/to/xxx.ttf

外部字体库非必要

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago