var ... JPG:TJPEGImage; .... begin JPG:=TJPEGImage.Create; ... ImgBuf.Position:=0; JPG.LoadFromStream(ImgBuf);