The image may not be fully loaded, so the sizes cannot be set. But without your code, I cannot say what you are doing wrong, but here is an Example that will work:
function LoadImage(isrc) { var oImg = new Image(); oImg.src = isrc; if (oImg.complete) { window.alert(oImg.src + ' ' + oImg.width + ' x ' + oImg.height); } else { window.setTimeout('iLoad(imgsrc)', 1000); } } <body onLoad='LoadImage(imgsrc)'>
source share