Largura da imagem real com JavaScript

// width in pixels
function setImagesWidth(id, width)
{
    var images = document.getElementById(id).getElementsByTagName("img");
    var newWidth = width + "px";
    for (var i = 0; i < images.length; ++i)
    {
        if (images[i].clientWidth > width)
        {
            images[i].style.width = newWidth;
        }                       
    }
}
Code with bulbul