473,394 Members | 1,722 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Getting the width/height of an image

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
nj********@hotmail.com
http://www.nathansokalski.com/
Nov 19 '05 #1
3 1653
"Nathan Sokalski" <nj********@hotmail.com> 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/>

Nov 19 '05 #2
I seem to be having trouble doing this. Do you have a small example? Thanks.
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/

"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
"Nathan Sokalski" <nj********@hotmail.com> 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/>

Nov 19 '05 #3
"Nathan Sokalski" <nj********@hotmail.com> 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/>

Nov 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Phil K | last post by:
I'm trying to format a table where each row will contain a single line of text followed by a number of optional icon images (sometimes none). However, I'm having great difficulty in getting an even...
2
by: Van der Weij | last post by:
Hi, I want to preload some images for a webpage _and_ determing their width and height. The problem is that the scripts continue while the images are loaded in the background, while I need the...
1
by: Mustafa Rabie | last post by:
dear all, i am writing an application where the user can upload his own picture. I wanted to get the Width and Height of the uploaded picture. So i assigned the uploaded image to an aspnet...
3
by: Hitesh | last post by:
Hi, I am getting the response from another Website by using the HttpHandler in my current site. I am getting the page but all the images on that page are not appearing only placeholder are...
7
by: chuck | last post by:
I load a bitmap using GDI+ now, I want to collect all the pixel values, (in RGB but without the A component) onto a color array, say... dim btmp1(,) as color is there a method that can help me...
2
by: sharma | last post by:
Hi, I Have a page which will take authentication from a diffrent page from a difrent website. My program needs to call a page like this from php page lets say:...
2
by: abrtlt | last post by:
I am using Ajax with a PHP script to obtain the name of gif files from a MySQL database. Javascript then embeds the actual file in the web page, thus displaying the image on the fly. For precise...
7
by: raylaur | last post by:
I'm using a javascript "slide" function to move a <div> layer in 10 pixel increments from one location on a page to another. The layer contains a GIF image. It's basically a side panel that flies out...
1
epots9
by: epots9 | last post by:
I have a image inside of a div <div id="image"> <div id="loader"> <img id="loaderImage" src="assets/loader.gif" alt="loading..." /> </div> <div id="loaded"> <img id="picture" src="" alt=""...
2
by: liketofindoutwhy | last post by:
For Firefox, we can get the computed style of an Img element, using the script in http://www.quirksmode.org/dom/getstyles.html so even if we set only the width of an Image in CSS, we will get...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.