delphi 从流(jpeg流,png流)到Timage 的显示方法

uses jpeg,pngimage

 


  jpg: TJpegImage;
  S: TStream;
  PngBit: TPngImage;

  img1: TImage;

    SetLength(A,流长度);
    S := TMemoryStream.Create;
    strCount := I;
    S.Write(A[0],strCount);
    S.Position := 0;//这一句是相当重要
    jpg := TJpegImage.Create;
    jpg.LoadFromStream(S);
    img1.Picture.Assign( jpg );


  PngBit := TPngImage.Create;
  PngBit.LoadFromStream(S);
  img1.Picture.Assign( PngBit );

你可能感兴趣的:(Delphi)