Getting the width/height of an image | Bytes (2024)

Home Posts Topics Members FAQ

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(i magelocation) 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********@hotm ail.com
http://www.nathansokalski.com/

Nov 21 '05 #1

Subscribe Reply

3 Getting the width/height of an image | Bytes (1) 3451 Getting the width/height of an image | Bytes (2)

Herfried K. Wagner [MVP]

"Nathan Sokalski" <nj********@hot mail.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(i magelocation) 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 21 '05 #2

Nathan Sokalski

I seem to be having trouble doing this. Do you have a small example? Thanks.
--
Nathan Sokalski
nj********@hotm ail.com
http://www.nathansokalski.com/

"Herfried K. Wagner [MVP]" <hi************ ***@gmx.at> wrote in message
news:%2******** ********@TK2MSF TNGP10.phx.gbl. ..

"Nathan Sokalski" <nj********@hot mail.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(i magelocation) 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 21 '05 #3

Herfried K. Wagner [MVP]

"Nathan Sokalski" <nj********@hot mail.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\Ang ler.bmp")
MsgBox(i.Width. ToString() & " " & i.Height.ToStri ng())
///

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

Nov 21 '05 #4

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

Similar topics

2 3586

Problem getting an even spacing between lines

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 spacing between each row of the table. A much simplified example of the kind of thing I want to do is shown in the html below: <html> <head> <title>Format Test</title> <style>

HTML / CSS

2 2930

Preloading images, and getting their height and width (firefox)

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 thus undefined values of image.width and image.height. Thus I'm looking for a function which stops executing my script until the images are all fully loaded.

Javascript

1 1919

Getting image height n width?

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 image control, but when i call the height and width properties of the image control it returns "" since they are not set. So how can i get this info? thanks mustafa

ASP.NET

3 3096

Images not getting rendered when using httphandler

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 displayed. Can anybody know this issue and help me to resolve this. In past i received the response saying that i should download the image first and then parse the actual response and modify the src attribute of the

ASP.NET

7 6103

getting bitmap RGB values

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 collect the pixel values as quickly as possible (like one row at a time)? what about setting (or changing) the pixel values back onto the bitmap?

Visual Basic .NET

2 1413

getting other webpage results in to php page

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: www.abc.com?handshake.jsp?userid=ettey1234&authtoken=94399843 my php page is at www.xyz.com

PHP

2 4756

getting image size when loading gif in page?

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 positioning, I would like to know the gif image size. Is there a way to obtain it using Javascript or otherwise? (I know the size is indeed contained in the gif format, as I can see it with a binary editor...) Thanks! Andrew

Javascript

7 2401

getting "afterimages" when moving layers in Firefox

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 when you click a button. The button is an invisible GIF with an anchor that calls slide() onClick. The animation works fine in IE but in Firefox I'm getting a series of afterimages as the function moves the layer to the goal. The image is painted...

HTML / CSS

1 4201

getting hidden image width/height in IE

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="" /><!--image in question--> <div id="closeAll" onclick="closeAll();">X</div> </div>

Javascript

2 3307

getting computed style for Img width and height

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 both the width and height of the final rendered image. However, it won't work in IE 7.... the width will return the original value, but the height is "NaN".... is there a way to get the final

Javascript

9716

What is ONU?

by: marktang |last post by:

ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...

General

9596

Changing the language in Windows 10

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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...

Windows Server

10607

Problem With Comparison Operator <=> in G++

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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...

C / C++

9182

AI Job Threat for Devs

by: agi2029 |last post by:

Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...

Career Advice

1 7645

Access Europe - Using VBA to create a class based on a table - Wed 1 May

by: isladogs |last post by:

The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...

Microsoft Access / VBA

5541

Trying to create a lan-to-lan vpn between two differents networks

by: TSSRALBI |last post by:

Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...

Networking - Hardware / Configuration

5677

Windows Forms - .Net 8.0

by: adsilva |last post by:

A Windows Forms form does not have the event Unload, like VB6. What one acts like?

Visual Basic .NET

1 4317

transfer the data from one system to another through ip address

by: 6302768590 |last post by:

Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

C# / C Sharp

2 3843

How to add payments to a PHP MySQL app.

by: muto222 |last post by:

How can i add a mobile payment intergratation into php mysql website.

PHP

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

To disable or enable advertisem*nts and analytics tracking please visit the page.

Getting the width/height of an image | Bytes (2024)

References

Top Articles
80+ Names for Girls Starting with R: With Meanings
Top Baby Girl Names That Start With R | Pampers
Why Are Fuel Leaks A Problem Aceable
Po Box 7250 Sioux Falls Sd
Skyward Houston County
Satyaprem Ki Katha review: Kartik Aaryan, Kiara Advani shine in this pure love story on a sensitive subject
El Paso Pet Craigslist
Tv Guide Bay Area No Cable
Arrests reported by Yuba County Sheriff
Pwc Transparency Report
Scholarships | New Mexico State University
Help with Choosing Parts
Elbasha Ganash Corporation · 2521 31st Ave, Apt B21, Astoria, NY 11106
Walmart End Table Lamps
Best Uf Sororities
Vandymania Com Forums
Walgreens Tanque Verde And Catalina Hwy
Tinker Repo
Iu Spring Break 2024
Stoney's Pizza & Gaming Parlor Danville Menu
Gina Wilson Angle Addition Postulate
Cardaras Funeral Homes
10 Best Places to Go and Things to Know for a Trip to the Hickory M...
Wku Lpn To Rn
Cinema | Düsseldorfer Filmkunstkinos
Lcsc Skyward
Kuttymovies. Com
Superhot Free Online Game Unblocked
Co10 Unr
Craftsman Yt3000 Oil Capacity
The Posturepedic Difference | Sealy New Zealand
Ezstub Cross Country
Poe T4 Aisling
Trust/Family Bank Contingency Plan
Duke Energy Anderson Operations Center
Sedano's Supermarkets Expands to Orlando - Sedano's Supermarkets
Tmka-19829
Main Street Station Coshocton Menu
Cdcs Rochester
Bones And All Showtimes Near Johnstown Movieplex
Fapello.clm
Lake Andes Buy Sell Trade
Vindy.com Obituaries
At Home Hourly Pay
Tfn Powerschool
Craigslist Rooms For Rent In San Fernando Valley
Arch Aplin Iii Felony
N33.Ultipro
Blog Pch
De Donde Es El Area +63
Noelleleyva Leaks
Who We Are at Curt Landry Ministries
Latest Posts
Article information

Author: Tuan Roob DDS

Last Updated:

Views: 6679

Rating: 4.1 / 5 (62 voted)

Reviews: 85% of readers found this page helpful

Author information

Name: Tuan Roob DDS

Birthday: 1999-11-20

Address: Suite 592 642 Pfannerstill Island, South Keila, LA 74970-3076

Phone: +9617721773649

Job: Marketing Producer

Hobby: Skydiving, Flag Football, Knitting, Running, Lego building, Hunting, Juggling

Introduction: My name is Tuan Roob DDS, I am a friendly, good, energetic, faithful, fantastic, gentle, enchanting person who loves writing and wants to share my knowledge and understanding with you.