FreeImage (lib) ImageHeight?

BlitzPlus Forums/BlitzPlus Programming/FreeImage (lib) ImageHeight?

Tyler(Posted 2005) [#1]
Is there any way to find the image height and width using images loaded by freeimage? This is the only thing standing in my way to victory! Hehe, I appreciate the help.


CS_TBL(Posted 2005) [#2]
images 'loaded' by freeimage???


Tyler(Posted 2005) [#3]
I really love/hate the guy who made the FreeImage Lib and named it ... FreeImage. I propose a renaming promptly, as to avoid any other confusion. "FreeImage" is a user made library of image loading and saving functions for JPG, TGA, TIF, etc. FreeImage, the function, I am aware, release the pictures from memory.


Snarty(Posted 2005) [#4]
Hiya,

The commands you are after should be:
Width=FI_GetWidth(FIBITMAP)
Height=FI_GetHeight(FIBITMAP)

I will be updating this lib eventually, just busy with ProPixel at the moment.


Tyler(Posted 2005) [#5]
Oh, are they already in there? and thank you for the reply! Where can I get the latest version?


Snarty(Posted 2005) [#6]
Yup, already in there. If you check the decls file you can see all the commands I've wrapped already.

Download the latest FreeImage from Here. Just overwrite the dll with this one. :)


Tyler(Posted 2005) [#7]
/me bows down to Snarty. You rock out loud!


Tyler(Posted 2005) [#8]
Ok, it got it to save out the TIFF file, but the tif saved has no preview, and cannot be opened with photoshop. Any idea what i did wrong?

The JPG BMP and PNG are the only ones that seem to save out right for me. I switch to TIFF and TGA, and I get the same results. Invalid files. Thanks!


Tyler(Posted 2005) [#9]
Nevermind, I think I fixed it. The FreeImage.bb I had this in it.

Function SaveTIFF(Image, File$, Compression=TIFF_NONE)

; Compression
; TIFF_PACKBITS = save using PACKBITS compression
; TIFF_DEFLATE = save using DEFLATE compression
; TIFF_ADOBE_DEFLATE = save using ADOBE DEFLATE compression
; TIFF_NONE = save without any compression (DEFAULT)

If Image
FIBITMAP=FIQSend(Image)
Suc=FI_Save(FIF_TARGA,FIBITMAP,File$,Compression)
FI_Unload FIBITMAP
If Not Suc Notify "TIFF Save Failed"+Chr(10)+File$
Else
RuntimeError "Image Instance Not Found (TIFF Save)"
EndIf

End Function


So, I changed the FIF_TARGA to FIF_TIFF and it seemed to have worked.


Snarty(Posted 2005) [#10]
ahh, yeah, my fault. There were still a few issues in the lib before I was cut from the net. But, now I'm back I'll revisit the lib and ensure it caters for the latest FreeImage dll and also iron out any issues.

I'm pleased you found the issue though.


Tyler(Posted 2005) [#11]
I thank you a lot for creating this library! Glad I could get it sorted out too. I was able to finish my program and it works beautifully thanks to you! All it does is crop and scale images, but the kind of images was the key :D Thanks again!