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

Just starting out? Need help? Post your questions and find answers here.
Jose
User
User
Posts: 34
Joined: Sat Apr 26, 2003 9:20 pm

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

Post 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
User avatar
einander
Enthusiast
Enthusiast
Posts: 744
Joined: Thu Jun 26, 2003 2:09 am
Location: Spain (Galicia)

Post 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
Jose
User
User
Posts: 34
Joined: Sat Apr 26, 2003 9:20 pm

Post 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.
Post Reply