length and width of an image

Posted on 2005-03-27
Medium Priority
Last Modified: 2010-04-23

Does anyone have some code to determine the length and width of an image?

Question by:brokeMyLegBiking
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
LVL 14

Expert Comment

ID: 13641601
Is this working for you?
    Dim image As System.Drawing.Image
    image = ...... 'Some image file

   Dim width As Integer = image.Width
   Dim height As Integer = image.Height
LVL 10

Expert Comment

ID: 13641790
u need to set the PictureBox controls SizeMode to Autosize..and then try this..

MessageBox.Show(pictureBox1.Width.ToString() + " " + pictureBox1.Height.ToString());

LVL 86

Accepted Solution

Mike Tomlinson earned 2000 total points
ID: 13642434
Use the FromFile() method to load the image first:

    Dim img As Image = Image.FromFile("c:\someFile.someExtension")
    Dim width As Integer = img.Width()
    Dim height As Integer = img.Height()

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Suggested Courses

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question