Javascript 如何使用fabricjs增加从画布下载的图像的大小?

Javascript 如何使用fabricjs增加从画布下载的图像的大小?,javascript,canvas,fabricjs,Javascript,Canvas,Fabricjs,我正在使用下面的内容下载我的fabricjs画布,效果很好,但我想知道如何才能将下载的图像放大,以便打印时更清晰?提前谢谢你的帮助 // Download as png function download(url, name) { // make the link. set the href and download. emulate dom click $('<a>').attr({ href: url, download: name })[0].cli

我正在使用下面的内容下载我的fabricjs画布,效果很好,但我想知道如何才能将下载的图像放大,以便打印时更清晰?提前谢谢你的帮助

// Download as png
function download(url, name) {
  // make the link. set the href and download. emulate dom click
  $('<a>').attr({
    href: url,
    download: name
  })[0].click();
}

function downloadFabric(canvas, name) {
  //  convert the canvas to a data url and download it.
  download(canvas.toDataURL(), name + '.png');
}
//下载为png
函数下载(url、名称){
//创建链接。设置href并下载。模拟dom单击
$('').attr({
href:url,
下载:姓名
})[0]。单击();
}
函数下载结构(画布,名称){
//将画布转换为数据url并下载。
下载(canvas.toDataURL(),name+'.png');
}

保存

这个结局类似于。从那时起,我可以将
{multiplier:4}
添加到
canvas.toDataURL()工作得非常出色。

这一结果类似于。从那时起,我可以将
{multiplier:4}
添加到
canvas.toDataURL()工作出色。

您可以将画布的宽度和高度设置为大于显示大小

<canvas width="2400" height="2400" style="width:600px;height:600px;"></canvas>

因为render
png
指的是画布
width
height


(您可以从小提琴上获得2400x2400图像)

您可以将画布宽度和高度设置为大于显示尺寸

<canvas width="2400" height="2400" style="width:600px;height:600px;"></canvas>

因为render
png
指的是画布
width
height

(您可以从小提琴上获得2400x2400图像)

可能的重复