var img = new Image(); img.onload = function() { alert([this.width, this.height]); } img.src = '/img/example.jpg';