ImageHeight/ImageWidth Example - does not work

BlitzPlus Forums/BlitzPlus Programming/ImageHeight/ImageWidth Example - does not work

julianbury(Posted 2005) [#1]
I need to make some thumbnails of a picture library.
I want to automate it with Blitz Plus.

The idea is to have the thumbnail width always at 100 pix
and do a calculation to find the proper height to keep the aspect ratio.

I looked up ImageWidth() and copied the example from the online help site.

It looks like this:
; ImageHeight/ImageWidth Example

; Global, as always, for graphics
Global gfxPlayer

; Enter graphics mode and start double buffering
Graphics 640,480,16
SetBuffer BackBuffer()

; Load the image-assign the handle to gfxPlayer
gfxPlayer=LoadImage("Jessica Miller 01.bmp")

; Print the image dimensions
Print "The image height is: " + ImageHeight(gfxPlayer)
Print "The image width is: " + ImageWidth(gfxPlayer)

; Wait until ESC is pressed so you can see the output
While Not KeyHit(1)
Wend


Pressing F7 indicates no errors but running it provakes the Windows offer to send details to MS before shutting down the program.

I tried it with bmp, gif and jpg files, all with the same result.

Can anyone suggest a solution?

Thank you for your kind attention.

Julian (-_-)


Snarkbait(Posted 2005) [#2]
Works fine here... make sure your program is compiled in the same folder as the image file you are loading, and test the load before using the height/width commands

; Load the image-assign the handle to gfxPlayer
gfxPlayer=LoadImage("Jessica Miller 01.bmp")

if not gfxPlayer runtimeerror "Unable to load image"



Nicstt(Posted 2005) [#3]
will allow u to locate the file to be sure its there, presuming you are using blitz+

dirPath$ = RequestFile ("Select a picture to load...", "bmp,BMP,jpg,*.*,jpeg,JPG,JPEG", 0 )
If dirPath$ <> ""
 ; whatever u want to do with the file
EndIf