【发布时间】:2021-06-18 13:37:45
【问题描述】:
我最近遇到了“Canva”node.js 模块中的模糊过滤器问题。
它只是不起作用,没有错误或其他任何东西
const canvas = Canvas.createCanvas(560, 315);
const ctx = canvas.getContext('2d');
const background = await Canvas.loadImage('./wallpaper.jpg');
ctx.drawImage(background, 0, 0, canvas.width, canvas.height);
ctx.strokeStyle = '#74037b';
ctx.strokeRect(0, 0, canvas.width, canvas.height);
const attachment = new Discord.MessageAttachment(canvas.toBuffer(), 'welcome-image.png');
ctx.filter = "blur(500)"
问题已经打补丁了
【问题讨论】:
-
看起来 node-canvas 还不支持过滤器 API。有关更多信息,请参阅this 问题。
-
我建议使用 API 进行图像处理,如果您有兴趣,我实际上自己编写了一个,用于图像处理,它会制作模因和模糊图像等.....
标签: javascript node.js canvas discord.js blur