I have developed subrountines in Code Center at my site at http://www.pinc.com/~slambert that allow a macro to get the height and width of an image in pixels from either a jpeg or gif image.
I haven't tested them on some of the more exotic subspecies (animated gifs for example)of these formats, but they seem to work with the garden variety jpegs and gifs.
Anyone who has mucked about with the HTML img src tag should see plenty of pontential here.
To demo these subrountines, I wrote imgsize.vdm which is in the Macro Library which will go through a local copy of a website and search out any img src tag and add the correct height and width attributes for jpeg or gif images. (it seems to work, but do a backup of the html, before trying it)
The way these subrountines work is a bit of a kludge. There is a more fool-proof way, but the code is in Pascal, which is in that big hole of what I don't know. Any Pascal Whiz want to try to translate it into Vedit Macro language ?