ImageEn, unit imageenio

TImageEnIO.LoadFromStreamWebP

TImageEnIO.LoadFromStreamWebP


Declaration

function LoadFromStreamWebP(Stream: TStream): Boolean;


Description

Loads an image from a stream containing a WebP file.
The result will be false if an error is encountered, e.g. the file in the stream is not WebP format (Aborting will be true).

Note:
 LoadFromStreamWebP requires Delphi 12 or newer. You must add Vcl.Skia to the uses clause (of any of your project units) to support WebP
 You can also load WebP, using ImageMagick or WIC
 Does not reset the position of the stream, so you may need to first call Stream.Position := 0;


Example

uses
  Vcl.Skia;

// loads a WebP file with LoadFromStreamWebP
var
  fs: TFileStream;
Begin
  fs := TFileStream.Create('myfile.WebP', fmOpenRead);
  if ImageEnView1.IO.LoadFromStreamWebP(fs) = False then
    ShowMessage('Not a WebP file!');
  fs.free;
End;