toDataUrl回到图片很模糊

时间:2019-07-16 06:40:37

标签: javascript html5-canvas

我已经将toDataUrls保存在数据库中,并且我想将它们转换为图像并显示在列表中。尽管图像出现了,但它们非常模糊。有人可以告诉我解决方法。预先谢谢你

     var node = document.createElement("li");
     var d0 = document.createElement("div");
     var c = document.createElement("canvas");
     var c4 = c.getContext("2d");
     var d = new Date();
     var x0 =  d.getTime();

     c.id = 'can' + x0 ;

     c.width  = 200; // in pixels
     c.height = 200; // in pixels

     var myImg = new Image;


     myImg.src = datapo;
     myImg.width = c.width;
     myImg.height = c.height;




     myImg.onload = () => {

     c4.drawImage(myImg, 0, 0, c.width, c.height);
     document.body.appendChild(c); // adds the canvas to the body element
     node.appendChild(c);
     document.getElementById("piclist").append(node);

     };

0 个答案:

没有答案