简体   繁体   English

画布到高分辨率图像

[英]Canvas to high resolution image

I am working on web app which has to export a high definition image from canvas (which is kind of screen shot of the web page). 我正在开发Web应用程序,该应用程序必须从画布导出高清晰度图像(这是网页的屏幕截图)。 So the exported image has to have up 300dpi so it would be printable. 因此,导出的图像必须具有300dpi的分辨率,以便可以打印。 Any known way of doing this ? 有任何已知的方法吗? What I have done some far is exporting the image with 96dpi which isnt quite what I was looking for ... 我所做的一些工作是以96dpi导出图像,这与我一直在寻找的不一样...

Thanks! 谢谢!

Just resize your canvas with css 只需使用CSS调整画布大小

var original_width = 1000;
var canvas = document.getElementById('canvas');
canvas.width = original_width;
canvas.style.width = original_width / (300/96);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM