如果你的canvas是被缩放了的,导出图片需要进行比例缩放 getBoundingClientRect() 方法返回元素的大小及其相对于视口的位置 const bbox = canvas.getBoundingClientRect(); const widthRatio = canvas.width / bbox.width; const heightRatio = canvas.