get image size in javascript code example

Example 1: javascript get image width and height

var img = new Image();
img.onload = function() {
  alert(this.width + 'x' + this.height);
}
img.src = 'http://www.google.com/intl/en_ALL/images/logo.gif';

Example 2: how to change size of image js

var image = document.getElementById('id');
image.style.width='imgWidth';
image.style.height='imgHeight';

Example 3: javascript get width of image

image.width

Example 4: javascript get image dimensions

var img = document.getElementById("myImageID"); 
var imgWidth = img.clientWidth;
var imgHeight = img.clientHeight;