Get pixel dimensions of jpg

Does anyone have code or know how to read the pixel dimensions of a jpg image? I am working on an application that writes html and javascript to make photo albums to viewed on web browsers. If these albums are viewed on mobile devices, the size of the image changes the size of other screen elements and so must be known by the routine that sets the page design

http://documentation.xojo.com/index.php/Picture
Open the picture, then check it’s .Width and .Height

Yes, thanks. I had not noticed these properties. I will give this a try

(I would still like to know how to read the info directly from the binary file. My program will sometimes have to process several thousand images)

Thanks

jpg does not store the width and height in it’s header directly. From what I remember, you’ll need to go through all the frames looking for a SOF marker and stuff like that. It will probably be much faster just loading the pic in xojo.

I hope you thought about saving the dimensions to your database during the import process then!

Walter, if you e-mail me at harriew at frontiernet dot net I can send you a copy of a little program I have that can determine the type of graphics file and then dig into it to find the width and height values. It works for BMP, GIF, JPG, PCT, PNG, and TIF files.