Quick way to get the dimensions of an image?

G

Gordon Scott

Is there a faster way to determine the dimensions (width, height) of an
image besides using a Bitmap object?

I've got a piece of code that is searching a directory structure for images
and retrieving their hieght and width.

I have been using a bitmap object like this to gain access to the Width and
Height parameters.

Bitmap bmp = new Bitmap(fullPath);


Only problem is that this slows down the code quite a bit. I image that it
is converting form png, gif, or jpg into bmp format when instantiating the
object.
Is there any other way to simply access the dimensions of an image file?
 
J

John B

Gordon said:
Is there a faster way to determine the dimensions (width, height) of an
image besides using a Bitmap object?

I've got a piece of code that is searching a directory structure for images
and retrieving their hieght and width.

I have been using a bitmap object like this to gain access to the Width and
Height parameters.

Bitmap bmp = new Bitmap(fullPath);


Only problem is that this slows down the code quite a bit. I image that it
is converting form png, gif, or jpg into bmp format when instantiating the
object.
Is there any other way to simply access the dimensions of an image file?
If the image format supports it and it has been written then you could
maybe read the Exif data.
Google for exif jpg and you should find some examples.

Cheers
JB
 

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