Fix bug in computation of "width" and "height" for images