Home > Article > Web Front-end > About html5 canvas_html/css_WEB-ITnose
var pic = new Image();
pic.src = "feather_default.jpg";
context2D.translate(0,0);
context2D.drawImage(pic,0,0);
Why is it always 300*150 when the canvas size is not set?
When setting the canvas size to any size, var data = canvas.toDataURL();, the image obtained is always 300*150. Why?
Ask for expert advice
Gang just saw you on Weibo Haha I saw you here again
Gang just saw you on Weibo. Haha, I saw you here again. Solved~~Thank you~~
I tested it yesterday. I don’t know how you set it. If you set the width directly on the canvas and height can get the actual value. If you use css, you can also get it. Maybe your method is wrong