ImageEn, unit imageenio

TImageEnIO.LoadFromStreamGIF

TImageEnIO.LoadFromStreamGIF


Declaration

function LoadFromStreamGIF(Stream: TStream): integer;


Description

Loads an image from a stream containing a GIF file.

Returns the number of images contained in the stream (if this is an animated stream) or -1 if an error was encountered while loading, such as the file not being GIF format (Aborting will be true). File access errors will raise an exception. If AsyncMode=True the result will always be -1.

Note:
You can abort loading by setting Aborting to true
If StreamHeaders property is True, the stream must have a special header (saved using SaveToStreamGIF).
LoadFromStreamGIF does not reset the position of the stream, so you may need to first call Stream.Position := 0;
By default, GIF_RawLoad is enabled, so the frame returned will be merged to ensure it is a valid image (contains needed content from prior frames)


Example

// loads a GIF file with LoadFromStreamGIF
var
  fs: TFileStream;
Begin
  fs := TFileStream.Create('C:\myfile.gif', fmOpenRead);
  ImageEnView1.IO.LoadFromStreamGIF(fs);
  fs.free;
End;


See Also

LoadFromFileGIF
SaveToStreamGIF
GIF_ImageIndex
GIF_ImageCount
Global Image Methods