GDI: fastest way to read image dimensions

  • Thread starter Thread starter Thomas
  • Start date Start date
T

Thomas

Hi all,

Is there a faster way to read image dimensions other than something
like:
ImageOrig = System.Drawing.Image.FromFile(Filepath);
ImageOrigHeight = ImageOrig.Height;
ImageOrigWidth = ImageOrig.Width;

The problem is this operation takes quite a bit of time to complete
(100+ ms).

What I'm doing is reading the original image size, calculating the new
image size, and then checking a cache where I save the output. If I
could figure out a faster way to get the h/w of the image first it
would help.

thanks,
Tom
 
Hi Thomas,
Hi all,

Is there a faster way to read image dimensions other than something
like:
ImageOrig = System.Drawing.Image.FromFile(Filepath);
ImageOrigHeight = ImageOrig.Height;
ImageOrigWidth = ImageOrig.Width;

Yes, there is!
The fastest way is to read image file header.
But i'm affraid that there is a lot of image formats that
you'll have to learn.

Look at:
http://www.fastgraph.com/help/image_file_header_formats.html

Cheers!

Marcin Grzębski
 
Back
Top