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