Determining the Size of a JPG File ?

E

eBob.com

Windows is good at this. In Windows Explorer if I rest the pointer over a
jpg file a little window popups giving the "Dimensions:" of the file. I
assume the values are in pixels.

So I am wondering how I can get the dimensions of a jpg file in VB.Net? Is
there a straightforward Class/Method for this? I haven't found any posts on
this specific subject. Browsing through MSDN documentation it looks like I
might be able to use System.Drawing.Imaging.Metafile or
System.Drawing.Bitmap. Does that sound reasonable? Is there another
Class/Method specifically for this purpose.

(I know about Dsofile.dll but I tried it and it does not help with jpg
dimensions. And I know I could determine the dimersions by reading the
first few bytes of the file, but I am hoping there might be an official way
to get the dimensions info.)

Thanks, Bob
 
Z

zacks

Windows is good at this. In Windows Explorer if I rest the pointer over a
jpg file a little window popups giving the "Dimensions:" of the file. I
assume the values are in pixels.

So I am wondering how I can get the dimensions of a jpg file in VB.Net? Is
there a straightforward Class/Method for this? I haven't found any posts on
this specific subject. Browsing through MSDN documentation it looks like I
might be able to use System.Drawing.Imaging.Metafile or
System.Drawing.Bitmap. Does that sound reasonable? Is there another
Class/Method specifically for this purpose.

(I know about Dsofile.dll but I tried it and it does not help with jpg
dimensions. And I know I could determine the dimersions by reading the
first few bytes of the file, but I am hoping there might be an official way
to get the dimensions info.)

Thanks, Bob

Image Class.

Check out the Height and Width properties.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top