Picture.FromData

From Real Software Documentation

Jump to: navigation, search
Shared method
Picture.FromData ( data As MemoryBlock ) As Picture
Introduced 2010r3

Obtains a picture that is stored in a MemoryBlock and returns a Picture.

Example

The following example takes a picture stored in a MemoryBlock and uses FromData to write it to a picture that is displayed in an ImageWell.

Dim imageData As String
Dim bs As BinaryStream

If productImageWell.image <> Nil Then
// Get a temporary file to save the image to
f = SpecialFolder.Temporary.Child( "Temp_Image.jpg" )

// Save the image out to the file
ProductImageWell.Image.Save(f,Picture.SaveAsJPEG)
// Open the file as a BinaryStream and read the data in
bs = BinaryStream.Open(f,False)
If bs <> Nil then
imageData = bs.Read( bs.Length )
Dim mb As MemoryBlock
mb = imageData
Imagewell2.Image=picture.FromData(mb)
bs.Close
End if

// delete the temporary file if it exists
If f.Exists Then
f.Delete
End if
End If
Personal tools