Search code examples
c#imagedimensions

How to get the the dimensions of an image file?


I have a file called FPN = "c:\ggs\ggs Access\images\members\1.jpg "

I'm trying to get the dimension of image 1.jpg, and I'd like to check whether image dimension is valid or not before loading.


Solution

  • System.Drawing.Image img = System.Drawing.Image.FromFile(@"c:\ggs\ggs Access\images\members\1.jpg");
    MessageBox.Show("Width: " + img.Width + ", Height: " + img.Height);