Code
Execute
<!DOCTYPE html> <html> <head> <title>Wikitechy drawImage Method</title> </head> <body> <h2>Wikitechy drawImage Method</h2> <p>Image to use:</p> <img id="scream" width="300" height="300" src="logo.png" alt="The Scream"> <canvas id="wikitechyCanvas" width="300" height="300" style="border:1px solid blue;"> </canvas> <script> window.onload = function() { var c = document.getElementById("wikitechyCanvas"); var context = c.getContext("2d"); var img = document.getElementById("scream"); context.drawImage(img, 10, 10); } </script> </body> </html>
Result