QB64.com

QB64 is a modern extended BASIC programming language that retains QBasic/QuickBASIC 4.5 compatibility and compiles native binaries for Windows, Linux, and macOS.

The _FREEIMAGE statement releases the designated file image created by the _LOADIMAGE, _NEWIMAGE or _COPYIMAGE functions from memory when they are no longer needed.

Syntax

_FREEIMAGE [handle&]

Description

Example(s)

Loading a program splash screen and freeing image when no longer necessary:


s& = _LOADIMAGE("SPLASH.BMP",32)  'load 32 bit(24 BPP) image
IF s& < -1 THEN SCREEN s&   'use image as a 32 bit SCREEN 
_DELAY 6                          'display splash screen for 6 seconds
SCREEN 0       'MUST change screen mode before freeing a SCREEN image!
IF s& < -1 THEN _FREEIMAGE s&  'handle value MUST be less than -1 or error!
CLS 

Note: A valid image file name must be used by _LOADIMAGE or the invalid handle memory value will not need to be freed.

See Also