Method 1: Set a fixed value, which is no different from setting the canvas's value in HTML:
function () { = +; = Thefunction() { = +; = $;}
Method 2: Modify the size with fixed, this way is similar to the first one, need to pass parameters, which is nothing;
function (width, height) { = height; = width;}
Method 3: The most wanted to record a way to set the size of the canvas according to a picture size:
var image = document.getElementById ("image"== image.height;
Method 4: Take the size of the image loaded in JavaScript, can not directly take image size is because when the execution of IMAGE.SRC, the picture loading is relatively delayed, that is, the size of the image at this time is still 0*0.
var New function() { = "Some/location/name.jpg"; function(){ = image.width; = image.height; }}
In particular, the above method 4, is their own understanding, do not know whether ....
HTML5 JavaScript modifies the size of the canvas