IMHO erkennt TWICImage bei LoadFromStream das Format.
Delphi-Quellcode:
procedure Test;
var
AImage: TWICImage;
ABitMap: TBitmap;
begin
AImage := TWICImage.Create;
ABitMap := TBitmap.Create;
try
AImage.LoadFromStream(AStream);
// Weiter entsprechend AImage.ImageFormat
// oder in eine Bitmap...
ABitMap.Assign(AImage);
finally
ABitMap.Free;
AImage.Free;
end;
end;
Bab es grad mal mit PNG ausprobiert:
Delphi-Quellcode:
procedure TForm11.Button1Click(Sender: TObject);
Var
AStream: TMemoryStream;
begin
AStream := TMemoryStream.Create;
try
AStream.LoadFromFile('r:\warning.png');
ShowImageFromStream(AStream);
finally
AStream.Free;
end;
end;
procedure TForm11.ShowImageFromStream(AStream: TStream);
Var
AImage: TWICImage;
begin
AImage := TWICImage.Create;
try
AImage.LoadFromStream(AStream);
Image1.Picture.Assign(AImage);
finally
AImage.Free;
end;
end;
Frank