To get width and height of an image we can use System.Drawing.Image class. This code snippet shows how to retrieve width and height of an image.

string filePath = @"c:\deepak\MeeGo.jpg";
Image img = Image.FromFile(filePath);
 
Console.WriteLine(string.Format("Height: {0}",img.Size.Height));
 
Console.WriteLine(string.Format("Width: {0}",img.Size.Width));
Tagged with:
 

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>