先记下来,试过后如果可用,就保留下来。
用到ZLIB和base64
ProcedureStrToBmpStream(v:OleVariant;VarStream:TMemoryStream);Var
Str:String;
MS1:TStringStream;
MS2:TMemoryStream;
Begin
IfVarIsNull(v)ThenExit;
Str:=VarToStr(v);
IfStr=''ThenExit;
MS1:=TStringStream.Create(Str);
MS2:=TMemoryStream.Create;
Base64DeCodeStream(MS1,MS2);
MS2.Position:=0;
ZDecompressStream(MS2,Stream);
Stream.Position:=0;
FreeAndNil(MS2);
FreeAndNil(MS1);
End;
FunctionBmpStreamToStr(Stream:TMemoryStream):String;
MS1:TMemoryStream;
MS2:TStringStream;
MS1:=TMemoryStream.Create;
MS2:=TStringStream.Create('');
ZCompressStream(Stream,MS1,zcMax);
MS1.Position:=0;
Base64EnCodeStream(MS1,245)">Result:=MS2.DataString;
ms:=TMemoryStream.Create;
StrToBmpStream('这里是BASE64编码的字符',ms);
image1.Picture.Bitmap.LoadFromStream(ms);
MS.Clear;
image1.Picture.Bitmap.SaveToStream(MS);
str:=BmpStreamToStr(MS)
将字符保存到XML即可 原文链接:https://www.f2er.com/xml/295462.html