Home  >  Article  >  Web Front-end  >  About html5 canvas_html/css_WEB-ITnose

About html5 canvas_html/css_WEB-ITnose

WBOY
WBOYOriginal
2016-06-24 12:13:531049browse

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


Reply to discussion (solution)

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

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn