Prev Demo
Imagesize
Next Demo
Write code here
J
|
B
|
A
<!DOCTYPE html> <html> <head> <title>ImageSize</title> </head> <body> <canvas id="myCanvas" width="278" height="400"></canvas> <script> var canvas = document.getElementById('myCanvas'); var context = canvas.getContext('2d'); var x = 20; var y = 15; var width = "200"; var height = "350"; var imageObj = new Image(); imageObj.onload = function () { context.drawImage(imageObj, x, y, width, height); }; imageObj.src = "http://techfunda.com/HTPictures/Generics/1-635716259621984414.jpg"; </script> </body> </html>
Note: We DO NOT save your trial code in our database.
Output