Page 1 of 1

How to find the height/width for gif or jpg file

Posted: Mon Apr 26, 2004 1:14 am
by Jose
Trying to quickyly get the size of an image file under windows, want to scan a list of files and get their height/width, any ideas how to do this.

Did a search found some old code using IMAGEINFO, but it no longer works, try this link.

viewtopic.php?t=3638&highlight=imageinfo

Thanks

Posted: Mon Apr 26, 2004 10:02 am
by einander
Hi Jose:
You can try ImageWidth() and ImageHeight() for BMP,JPG, PNG, TIFF and TGA images.

Code: Select all

UseJPEGImageDecoder()
UsePNGImageDecoder()
UseTIFFImageDecoder()
UseTGAImageDecoder()
;__________here start a loop
LoadImage(0, "c:\test.jpg")  ; ********here your images**********
Debug ImageWidth()
Debug ImageHeight()
FreeImage(0)
;_________end loop 
Hope this helps
Regards
Einander

Posted: Mon Apr 26, 2004 6:01 pm
by Jose
Thanks einander, I figured that one out after doing some testing, but what I really wanted was a windows API way to tell the height/width of any image, I just want the info, dont need to use the image files.

Anyone know how to use API GetImageInfo() or something like it to get image file height/width.