Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Image file dimensions

Status
Not open for further replies.

TonyMcGuire

Programmer
Aug 17, 2004
692
US
In Windows Explorer (on some systems (XP?)), you can put your mouse over an image file and the 'tip' text shows the dimensions of the image.

Image editors, once you load the image, can give you the dimensions of the image.

Anyone have code that can read the header (I'm supposing) and retrieve the dimensions without having to load the entire image file?

We've been able to figure out some image formats just reading the binary and picking out the correct characters that represent the image dimensions, but this isn't 100% reliable, particularly with jpegs.

Any help/pointers appreciated.

Tony McGuire
 
I already have an activeX control that can give me the information after loading the image.

I am trying to get the information by [?] reading the header of the file directly. Thus avoiding loading multiple MB of image just to get the image dimensions.

I thought maybe there is an API call that can do this....????

Tony McGuire
 
Well, the activeX control I was referring to doesn't make you load the thing, you can read it's properties directly.

I know no other way, myself.
 
Hmmm. I looked at the site you posted briefly, and from what I saw it looked like the image had to be loaded (at least in memory, not necessarily on a display object).

But I was also hoping to find a free way with an API, since Windows Explorer can evidently do this.

I appreciate you taking the time to post, and point me to the DLL.


Tony McGuire
 
Well, I believe that the only thing that gets loaded is the activeX control, not that actual image. I can get all the parameters of the image (size, number of pages, etc>) without ever displaying the image.

I work with images every day, and this was the best thing I could come up with on a budget.
 
I, too, have an activeX for working with images. It was $30, royalty-free.

However, in order to get the image info, I have to have the control open the image; this then also loads it into memory (the control is in memory as well, not displayed on any object).

Which causes the image to be loaded into memory, whether I display it or not.

For what I am trying to do, loading tens, hundreds or thousands of MB of image would be slow.

And again, thanks for taking the time on this.

Tony McGuire
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top