Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
Suggested Courses

581 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