Trying to assign remote PNG file to TImage. I’ve tried following, it says “Invalid stream format”. I have no clue how to download PNG image into Firemonkey styled apps (XE8):
procedure TfrmMain.Button1Click(Sender: TObject);
var qrString: String;
MS : TMemoryStream;
Png: TImageMultiResBitmap;
begin
MS := TMemoryStream.Create;
Png := TImageMultiResBitmap.Create(Png);
try
IdHTTP1.get(‘https://chart.googleapis.com/chart?chs=300×300&cht=qr&chl=chujisko’,MS);
Ms.Seek(0,soFromBeginning);
Png.LoadFromStream(MS);
img1.MultiResBitmap.Assign(Png);
finally
FreeAndNil(Png);
FreeAndNil(MS);
end;