ImageEn, unit imageenio

TImageEnIO.LoadFromStream

TImageEnIO.LoadFromStream


Declaration

function LoadFromStream(Stream: TStream; FileFormat: TIOFileType = ioUnknown): Boolean;


Description

Load an image from the specified stream into the attached TImageEnView or TIEBitmap.
If FileFormat is ioUnknown the file format is detected by reading the image header (using FindStreamFormat).
The result will be false if an error is encountered, e.g. the file in the stream is not a recognized format (Aborting will be true).

If the StreamHeaders property is True, the stream must have a special header (saved with SaveToStream).

Note:
 You can abort loading by setting Aborting to true
 This method can load IEV (TImageEnVect objects) and IEN+IEV formats when AttachedImageEn is TImageEnView or TImageEnVect
 LoadFromStream does not reset the position of the stream, so you may need to first call Stream.Position := 0;


Examples

// load an image from a stream
if ImageEnView1.IO.LoadFromStreamFormat( stm ) = False then
  ShowMessage('Not an image!');

// load a jpeg from a stream
if ImageEnView1.IO.LoadFromStreamFormat( stm, ioJPEG ) = False then
  ShowMessage('Not a JPEG!');


See Also

 LoadFromFile
 WicFastLoading