Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Getting the width/height of an image

Reply
Thread Tools

Getting the width/height of an image

 
 
Nathan Sokalski
Guest
Posts: n/a
 
      05-24-2005
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
http://www.velocityreviews.com/forums/(E-Mail Removed)
http://www.nathansokalski.com/


 
Reply With Quote
 
 
 
 
Herfried K. Wagner [MVP]
Guest
Posts: n/a
 
      05-24-2005
"Nathan Sokalski" <(E-Mail Removed)> schrieb:
>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.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

 
Reply With Quote
 
 
 
 
Nathan Sokalski
Guest
Posts: n/a
 
      05-24-2005
I seem to be having trouble doing this. Do you have a small example? Thanks.
--
Nathan Sokalski
(E-Mail Removed)
http://www.nathansokalski.com/

"Herfried K. Wagner [MVP]" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> "Nathan Sokalski" <(E-Mail Removed)> schrieb:
>>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.
>
> --
> M S Herfried K. Wagner
> M V P <URL:http://dotnet.mvps.org/>
> V B <URL:http://classicvb.org/petition/>



 
Reply With Quote
 
Herfried K. Wagner [MVP]
Guest
Posts: n/a
 
      05-25-2005
"Nathan Sokalski" <(E-Mail Removed)> schrieb:
>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())
///

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
You Mean I Won't Be GEtting Paid More for Getting This Cert? TBone MCSE 13 10-30-2007 01:10 PM
Re: You Mean I Won't Be GEtting Paid More for Getting This Cert? FrisbeeŽ MCSE 0 10-22-2007 03:32 PM
Getting User Input after getting Input from a file dei3cmix@uga.edu C++ 3 03-23-2006 05:01 AM
How to avoid getting BGP routes while getting a router's routing table ncosta@net.ipl.pt Cisco 2 01-25-2006 11:50 AM
wx.Image: Couldn't add an image to the image list. Laszlo Zsolt Nagy Python 1 01-26-2005 09:55 PM



Advertisments