1. Get the image size function getImageSize
function getImageSize(imageEl ) {
var i = new Image(); //Create a new image object
i.src = imageEl.src; //Assign the src attribute of the image to the src of the new image object
return new Array (i.width, i.height); //Return the length and width pixels of the image
//return [i.width, i.height];
}
2. Example
var imgEl = document.getElementById(imgEl),
imgSize = getImageSize(imgEl),
imgWidth = imgSize[0], //Get the width of the image
imgHeight = imgSize[1]; //Get the height of the image