About html5 canvas_html/css_WEB-ITnose

WBOY
Release: 2016-06-24 12:13:53
Original
1050 people have browsed it

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

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template