Prev Demo
HTML5
>
Canvas Images
Next Demo
Write code here
J
|
B
|
A
<!DOCTYPE html> <html> <head> <title>Demo</title> </head> <body> <h1>Draw Image</h1> <canvas id="myCanvas" width="500" height="200"></canvas> <script> var canvas = document.getElementById('myCanvas'); var context = canvas.getContext('2d'); var imageObj = new Image(); imageObj.onload = function () { context.drawImage(imageObj, 20, 40); }; 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