loadRaw
Top  Previous  Next

laodRaw (integer Input, string File, integer Offset, integer Width, integer Height
[, integer Bpp =8, integer Gray =1 ] )  

Use this function to open a non-standard image file written in an uncompressed format.

Parameters

Input  
 
An integer between 1 and 116 specifying the number of the frame in which the image will open.  
 
File  
 
A string specifying the path and name of the file from which the image will be loaded. If the path is not specified, the default directory will be used.  
 
Offset  
 
A positive integer specifying the number of bytes in the beginning of the file preceding the actual pixel data.  
 
Width, Height  
 
Positive integers specifying the width and height of the image in pixels (number of columns and rows in the image matrix).  
 
Depth  
 
An optional integer specifying the amount of bits per pixel in the image. Must be one of the following values: 8, 16, 24, 32, and 48.  
Default value: 8  
 
Gray  
 
An optional boolean integer that defines if the image must be imported as a grayscale one. Must be one of the following values:  
 
FALSE=0 – the image will be opened as a color one. Depending on the on the Depth parameter, the pixel data will be interpreted as 8-bit palette indexes or 16-bit, 24-bit, 32-bit and 48-bit RGB triads  
TRUE=1 – the image will be opened as a grayscale one. Depending on the Depth parameter, the pixel data will be interpreted as 8-bit, 16-bit and 32-bit integer intensities.  
Default value: TRUE  
 
Error flags

ERR_OK  
 
The flag set if successful.  
 
ERR_FAILED  
 
The flag set if failed.  
 
ERR_NOTFOUND  
 
The flag set if the file was not found.  
 
ERR_BADFORMAT  
 
The flag set if the file format was not recognized  
 
Example

The following set of statements imports a 16-bit grayscale image from a non-standard image file.  
 
Offset=260  
Width=640  
Hight=480  
loadRaw(1, "c:\testraw.img", offset, width, height, 16, TRUE )  
err=getError()  
if not ret=ERR_OR then print getErrorText(err)  
 
Remarks

If you have no information about the size and/or type of the image file, you can determine the information through trial and error. It can be done by repeatedly opening an image file with different argument values and viewing the resulting image on the screen. By varying the Width and Height and pixel Depth, you can obtain a recognizable image on the screen. You then determine the Offset by closely examining the first pixels in the image and removing any that do not look like pixel data.