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
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

// Load 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