Using html2canvas i'm trying to capture a div and save it as a .png file, and it works!
(just using window.open in example to simplify it - same quality problem)
However the image sharpness / quality of the images inside the targeted div is pretty bad. I'm not quite sure how to improve the image quality/sharpness. Any suggestions ?
saveAsPNG function:
saveAsPNG = function(id) {
var target = document.getElementById(id);
html2canvas(target, {
onrendered: function(canvas) {
var data = canvas.toDataURL("image/png", 1);
window.open(data);
}
});
};
What does html2canvas is not "actually" taking a screenshot but making representation. So it builds the screenshot 来构建屏幕截图
Maybe an option not to take blurry images is to use it.
https://github.com/ivoviz/feedback
This is a jQuery plugin based on html2canvas, which allows you to take screenshots to a certain part of the page. Give it a try :)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.