Skip to main content

LoadRawImage Method

Loads an image from an array of bytes.

Definition​

Result = LoadRawImage(Data, Len)

Parameters​

ParameterDescription
DataThe image data
LenThe length of the data in bytes

Returns​

1 if loaded, 0 if not

Remarks​

The LoadRawImage method can be used to load images from an array of bytes. This is particularly useful when you are storing your images in the database. There is some caution to be considered when using this method. You will be using pointers, so make sure you're precise in when sending your input.

The Data paramater will receive a pointer to your array of bytes. Essentially, you'll load the image data into a variable, then use the GetPointer stored procedure to pass the pointer to this method. The Len parameter must be set to the length of the data in bytes. The Len function in BASIC+ should be sufficient.

Example​

// Load an image from the database
Open "IMAGE" to hTable then
   Read Data from hTable, "MY_IMAGE" then
       Send_Message(@Window:".OLE_PICTURE", "OLE.LoadRawImage", GetPointer(Data), Len(Data))
   end
end