渲染画布后,toDataURL返回带有画布比例的图像(我的画布比例为700 x 600)。如何以原始高度和宽度返回图像。不是画布宽度和高度。这是代码部分。
$(document).on('click','#btn-save-canvas', function(event) {
if (!fabric.Canvas.supports('toDataURL')) {
alert('This browser doesn\'t provide means to serialize canvas to an image');
}
else {
canvas.overlayImage.filters = [];
canvas.overlayImage.applyFilters();
canvas.renderAll();
var multi = maskOriWidth/maskWidth;
console.log(multi);
window.open(canvas.toDataURL({
format: 'png',
multiplier: 0,
}));
}
});