Quick way to get the dimensions of an image?

  • Thread starter Thread starter Gordon Scott
  • Start date Start date
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?
 
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
 
Back
Top