Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在为此制作一个 html5 画布,我正在使用 konvajs 和 anglurjs。我想以更高的分辨率导出画布的可见区域。
我可以使用stage.toDataURL('JPEG',1.0)导出可见区域,但它会重新调整图像的分辨率。它根据浏览器窗口设置图像尺寸,但我想以与导入相同的分辨率导出图像。
有一个未记录的配置为stage.toDataURL()被调用pixelRatio:
stage.toDataURL()
pixelRatio
stage.toDataURL({ pixelRatio: 2})
此命令将以更高的分辨率保存画布。
演示: http: //jsbin.com/quveduhihe/edit ?html,js,output