Getting the width/height of an image

  • Thread starter Thread starter Nathan Sokalski
  • Start date Start date
N

Nathan Sokalski

I need to get the width and height of a GIF image through code. I need this
info so that I can set the width and height properties of Image and
ImageButton objects. System.IO.File.GetAttributes(imagelocation) only seem
to return properties that all files have, which does not include width and
height. How can I get this info? Any help would be appreciated. Thanks.
 
Nathan Sokalski said:
I need to get the width and height of a GIF image through code. I need this
info so that I can set the width and height properties of Image and
ImageButton objects. System.IO.File.GetAttributes(imagelocation) only seem
to return properties that all files have, which does not include width and
height. How can I get this info?

Load the file using 'Image.LoadFrom' and check the 'Image' object's 'Height'
and 'Width' properties.
 
Nathan Sokalski said:
I seem to be having trouble doing this. Do you have a small example?
Thanks.

\\\
Dim i As Image = Image.FromFile("C:\WINDOWS\Angler.bmp")
MsgBox(i.Width.ToString() & " " & i.Height.ToString())
///
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top