feat: 更新一些配置

main
lichaojun 1 year ago
parent cd12c7fd59
commit 96f3b95bc1

@ -2,7 +2,7 @@ const config = {
//基础公共配置
base: {
// 指定要查找的目录
directoryPath: 'E:/商品资料汇总/商品资料(1051-1100)',
directoryPath: 'E:/商品资料汇总/商品资料(1101-1150)',
/**
* 图片文件夹路径
* 1. 配置文件中inputDir为空
@ -13,7 +13,7 @@ const config = {
*/
inputDir: '',
// 要转换的文件个数, 0表示全部转换
rangeNum: 10,
rangeNum: 15,
},
// 裁剪商品封面图
cover: {

@ -27,7 +27,7 @@ async function nodeGenWatermark({ img, text, filepath }) {
* @param {string} color 字体颜色
* @return {Buffer}
*/
function text2SVG({ text, fontSize = 24, color = 'rgba(204, 204, 204, 0.3)' }) {
function text2SVG({ text, fontSize = 24, color = 'rgba(204, 204, 204, 0.2)' }) {
const fontPath = path.join(__dirname, '../assets/STHUPO.TTF');
// 加载字体文件
const text2SVG = Text2SVG.loadSync(fontPath);
@ -47,7 +47,7 @@ async function nodeGenWatermark({ img, text, filepath }) {
*/
async function rotateWatermarkBuffer(text) {
// ` ${text} ` 增加下文字间距
const textBuffer = text2SVG({ text: ` ${text} ` });
const textBuffer = text2SVG({ text: ` ${text} ` });
return sharp(textBuffer)
.rotate(330, { background: { r: 255, g: 255, b: 255, alpha: 0 } }) // 旋转330度并且透明色
.toBuffer();

Loading…
Cancel
Save