function imagePreLoader(filename){ var im = new Image(); im.src = filename; return im; } var baseImage = imagePreLoader("assets/base.png"); This will call the imagePreLoader function to load the file base.png in your assets subdirectory into the canvas. You have to do two additional sub-steps before you can see this image. You have to wait for the image to load You have to ask the javascript context object to render the image on the canvas. baseImage.addEventListener("load", drawImage); tells javascript to listen for an event to occur and when that event (“load” corresponding to the loading of the image, baseImage) occurs to call the function named drawImage. function drawImage(){ ctx.drawImage(baseImage, 320, 240); } will draw the image on the canvas at location (320, 240).