HELP! FreeImage and BlitzPlus

BlitzPlus Forums/BlitzPlus Beginners Area/HELP! FreeImage and BlitzPlus

SuperDan(Posted 2012) [#1]
Hi All, it's been a few years since I used blitz but I am trying to make a simple program to edit text and crop images and then upload the stuff to our company website (a basic content management type thing).

I have got all the downloading/uploading stuff sorted but I am struggling with getting freeimage working in BlitzPlus.

I am using the info here to install all the userlibs etc (which I have done) http://www.blitzbasic.com/codearcs/codearcs.php?code=1732 .

When I try and run the examples provided by mark I get the error "Invalid Blitz2D Buffer Handle". I assumed that this is because the freeimage.bb file is meant for Blitz3D, but at the top of the code it says it is for B3D or B+.

I have been all through the forums to try and find examples of where people have used the freeimage libs in B+ and anything I try just fails. If anyone out there is still using B+ and has experience with Freeimage I would be VERY grateful to hear any comments you may have.

Am I flogging a dead horse here or is this library coupled with B+ still usable?

Last edited 2012


Floyd(Posted 2012) [#2]
I just tried this and it worked with the sample
;FiLoadImage

Include "freeimage.bb" ;FreeImage Module

Graphics 640, 480, 0, 2
SetBuffer BackBuffer()

image = FiLoadImage("spark.bmp") ;Load image

While Not KeyHit(1)
 Cls

 DrawImage image, MouseX(), MouseY() ;Draw the image
 Text 0, 0, "image = "+image

 Flip
Wend
End

I had to jump through some Windows 7 privileges hoops. It didn't want me to save files in the :\Program Files (x86)\BlitzPlus folder.

But after dealing with that and supplying an image for spark.bmp it ran successfully.


SuperDan(Posted 2012) [#3]
Thanks Floyd.

I should have tried it with a .bmp first but I jumped the gun and went for a .jpg file I already had in the folder.

I didn't imagine it could be that simple, but why won't a .jpg file work? I made an image 50x50 pixels and saved it as spark.bmp, it worked fine. I then saved the exact same image as a spark.jpg but it now refuses to load.

I have loaded and manipulated jpegs using just B+ without FreeImage installed, so I am guessing the error has something to do with how FreeImage works.

Any thoughts on that? Am I missing something when loading images using FreeImage.

Thanks for your help, much appreciated.
Dan.