转换函数没有问题,
imagestream.ReadBuffer(Buffer,2); //这里流的位置加了2,所以下面要重新定位为0if (Buffer=$D8FF) or (Buffer=$4947) then //jpg gif
   begin
      imagestream.Position:=0;//增加这个
      tmpjpg.LoadFromStream(imagestream);
      form1.image1.Picture.Bitmap.Assign(tmpjpg);
       imagestream.Free;
   end