t-comm
Version:
专业、稳定、纯粹的工具库
28 lines (27 loc) • 693 B
TypeScript
/**
* 为图片增加文字
*
* @param {Object} config 配置
* @param {number} config.width 宽度
* @param {number} config.height 高度
* @param {Array<string>} config.textList 文字列表,支持多行
* @param {string} config.imgPath 图片路径
* @returns {string} canvas.toDataURL生成的base64图片
*
* @example
*
* ```ts
* const imgUrl = addTextForImg({
* width: 300,
* height: 300,
* textList: ['第一行', '第二行'],
* imgPath: './test.png',
* })
* ```
*/
export declare function addTextForImg({ width, height, textList, imgPath, }: {
width: number;
height: number;
textList: Array<string>;
imgPath: string;
}): Promise<string>;