width and height for HTML <IMG> tag from VB

Does anybody know how I can determine the width/height
of a gif picture in the measurements that a Html browser
expects to see in
<IMG height="50" width="120" SRC=".......>
Please give me some code!!!
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

If you have read the line in then simply use:

Position = Instr(1,TheLine,"height",0)
SpacePosition = Instr(Position, TheLine, " ", 0)

Height = Mid(TheLine, Position+8, SpacePosition-(Position+8))

This should get the height then do the same thing with some different numbers to get the width.
VB-tinkererAuthor Commented:
I obviously didn't express myself very well.  What I want to do is
load a picture in VB and then determine the width number and the height number of the picture, so that I can use it in my html statement:

      <IMG height="50" width="120" SRC=".......>

In other words I want to be able to determine what the numbers should be so that I can write the above statement
Oh, can't you just load it into a picture box that has the autosize set to true, what happens is the picture box will shrink or expand to fit the image loaded into it, then just take the width and height from the size of the picturebox..?  I know VB 5.0's pictureboxes supports GIF and JPEG but you didn't state which version of VB you were using.
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

VB-tinkererAuthor Commented:
I am quite familiar with the .width and .height properties of the picture box.  However none of the measurements available seem to correspond to the measurements required in the HTML pages.  I tried to find a conversion factor - but the conversion factor seems to be non-constant:

e.g.  Picture Term_Small.gif

                       VB                                   HTML
height            990                                   62
width            1470                                   94

height             705                                    47
width               420                                   24

As the original question states:  I want some code that gives me
Since the Picturebox give the values in twips by default take the

or set your form to be in Pixels ScaleMode.

The Height and Width of Images in HTML is needed in Pixels.
VB-tinkererAuthor Commented:
Thanks - this seems to work fine.
If you know a faster way to do this (e.g. reading the .GIF file directly and getting the information from there) that would be great!!

Do you know how I now can award you the points?  I don't seem to have a rating possibility anymore?

Thanks again.
You couldn't give the points because I only put that in as a comment.  I do have a book here that tells what the header is:

DB   GIF87a
DB  0

       COLOR MAP - GLOBAL_FLAG_BYTE tells you how many
                                there will be (First 3 bits of the Byte) you                                        need to add 1 to it and shift left 3 times.
                                Maximum value is  is 8 and one shifted left
                                by 8 is 256.
                               DB ,
                               DW IMAGE_LEFT
                               DW IMAGE_TOP
                               DW IMAGE_WIDE
                               DW IMAGE_DEEP
                               DW LOCAL_FLAG_BYTE

IMAGE_WIDE and IMAGE_DEEP are what you would need.

This all seems complicated and I don't have much time mess with it but it comes from an older book called Bit-Mapped Graphics by Steve Rimmer (ISBN 0-8306-3558-0) The Copyright on the book I have is 1990 First Edition Six Printing.

They give examples in C and Assembly on how to decode a GIF as Well as BMP and TIFF Files.


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
VB-tinkererAuthor Commented:
Thanks - I'll check that out later.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.