I found this method:
Graphics g = e.Graphics;
Bitmap bmp = new Bitmap(\"winter.jpg\");
g.DrawImage(bmp, 0, 0);
Console.WriteLine(\"Screen resolution: \" + g.
Surely you've answered your own question, it's as simple as this:
Bitmap bmp = new Bitmap(@"winter.bmp");
Console.WriteLine("Image Width: " + bmp.Width);
Console.WriteLine("Image Height: " + bmp.Height);
The DPI info is really only useful when you are displaying or printing the image. In the sample code it is converting the image to a Graphics
object that can be used to draw it to the screen.
To answer the 2nd part of you question, you could parse the JPEG file header to find the width/height information without actually loading in the image. But to do this you'd need to know the header information and file format for JPEG files.