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

3 Getting the width/height of an image | Bytes (1) 3449 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 3585

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 2929

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 1917

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 3093

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 1412

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 2397

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 4200

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

9698

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

10524

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++

1 10278

The easy way to turn off automatic updates for Windows 10/11

by: Hystou |last post by:

Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...

Windows Server

10055

Discussion: How does Zigbee compare with other wireless protocols in smart home applications?

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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...

General

5490

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

5619

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 4265

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 3786

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

3 2963

Comprehensive Guide to Website Development in Toronto: Expert Insights from BSMN Consultancy

by: bsmnconsultancy |last post by:

In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

General

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)

FAQs

How to find the height and width of an image? ›

Windows Explorer (Windows XP, Vista, 7, or 8)
  1. Click the Windows Start button on your taskbar.
  2. Type "Windows Explorer" or "File Explorer" into the search bar.
  3. Open Windows Explorer.
  4. Find the image you want to check.
  5. Select your image. The dimensions and file size appear at the bottom of the window.
Sep 2, 2020

How do I check the dimensions of an image? ›

On a PC (Windows 10):

If you do not see this, click the View ribbon tab and then Details Pane: You can also right-click on an image & choose properties from the drop-down menu. A new window will appear with several tabs. You'll click the details tab, and there you'll find you image size and dimensions.

What is the formula for the size of an image? ›

The magnification equation states that m = h i h o = − d i d o . We will use these steps, definitions, and equations to calculate the height of an image for a concave mirror in the following two examples.

How to measure height and width of image online? ›

Image Dimensions Finder

Just drag and drop your image here and it will automatically display its width and height in pixels. In addition to the dimensions, you can also find the image orientation, aspect ratio, as well as view the size and format of the image, and the number of pixels it contains.

What is the formula for image height? ›

What is the formula to determine the height of an object's image when the diameter, distance of the mirror and object's height is given? The height of the image would be the ratio of the image distance and object distance times negative height of object; Hi= -(Ho)x Di/Do.

What is the width and height of a normal image? ›

An image size of 1280 x 720 pixels is large enough to be HD standard and is commonly used in photography and film. This size uses a 16:9 aspect ratio, which is also common in filmmaking.

How do I manually determine the size of an image? ›

Multiply height and width (this will help you to know the total number of pixel) Multiply the result by bit depth (this will help you to get the total number of bits data) Divide the result by 8 (then you'll have the file size in bytes) Divide the result of bytes by 1024 (then you'll have the file size in kilobytes)

What is the dimension of the image? ›

The dimensions of an image correspond to its size, expressed in pixels, for example: 600px x 200px. As a reminder, pixels are a set of points that make up an image. The number of points present in the image constitutes the definition of the image.

How do I inspect the size of an image? ›

Google Chrome
  1. Right-click (pc) or command-click the image (mac) and select “inspect element”.
  2. Once the inspector pane opens hover over the highlighted img tag and it will display, over the image, the dimensions the image is being displayed at.

What is the formula for calculating images? ›

n = 360 θ - 1 if is even. n = 360 θ if it comes odd and when the object is placed asymmetrically. n = 360 θ - 1 when is odd and the object is kept symmetrically. n = 360 θ is a fraction, then the number of images formed will be equal to its integral part.

What is the equation for actual image size? ›

Magnification equation

Magnification = image size / actual size. Actual size = image size / magnification. Image size = magnification x actual size.

What is the size of the image? ›

The Basics:

Image Size is the term given to describe the height and width of an image in pixels. Maximum Image Size is determined by the megapixels of a given camera - for example, a 10-megapixel camera will give a maximum image size of 2592 by 3872 pixels.

How do I know the width and height of an image? ›

Open the page with your feed in Chrome. Right-click the image whose size you want to know and select Inspect. View the image width and height displayed in the Chrome DevTools. Note: The first number is always the width.

Can you get measurements from a picture? ›

In order to be able to measure absolute lengths in a photo, you have to provide at least one known reference size. ImageMeter can then use this given size to compute more dimensions in the image. There are different tools in ImageMeter to provide this reference size.

Can we measure height from a picture? ›

Yes it is possible to calculate someone's height from a picture if in the picture there is some point of reference. If the person is holding a full meter stick then we can use ratio and proportion to get his height. If the person is standing near a door then we can compare his height to a standard door.

How do you find height and width? ›

Start by identifying the longest side of your object as the length, then measure the width (perpendicular to the length), and finally measure the height, from the base to the top. Always ensure to measure from the correct starting and ending points for accurate results.

How do you find the width and height of a screen? ›

If you have the screens diagonal, you can multiply that measurement by 0.872 to get the screen's width. You can also multiply the diagonal by 0.49 to get the screen's height. Then, if you wish to find the screen area, multiply the width by the height.

How do you search images by width and height? ›

Open your browser and visit Google.com
  1. Type in your search terms.
  2. Select "Google search" or press return (or enter).
  3. Select on the images tab to limit search to the images database.
  4. Use the image filters to limit your search.
  5. Select on Search Tools to reveal advanced filter options.
  6. Select Size.
  7. Select Larger than...

How do you find the length width and height of an object? ›

When you see the dimensions of an object listed as “length x width x height,” it is referring to the measurement of that object in three-dimensional space. The length is always the longest side, the width is always the middle side, and the height is always the shortest side.

Top Articles
Latest Posts
Article information

Author: Rubie Ullrich

Last Updated:

Views: 5849

Rating: 4.1 / 5 (72 voted)

Reviews: 87% of readers found this page helpful

Author information

Name: Rubie Ullrich

Birthday: 1998-02-02

Address: 743 Stoltenberg Center, Genovevaville, NJ 59925-3119

Phone: +2202978377583

Job: Administration Engineer

Hobby: Surfing, Sailing, Listening to music, Web surfing, Kitesurfing, Geocaching, Backpacking

Introduction: My name is Rubie Ullrich, I am a enthusiastic, perfect, tender, vivacious, talented, famous, delightful person who loves writing and wants to share my knowledge and understanding with you.