 <pre><code>function GetAnImage(src) { var newImg = document.createElement('img'); newImg.src = src; return newImg; } var newImg = GetAnImage("abc.jpg"); newImg.onload = function () { var height = this.height; var width = this.width; //do with the image as you want } </code></pre> <p>i hope it helps.</p>