function TForm1.BaseToJpg(BaseStr: string): TJpegImage;
var
JpgStream: TMemoryStream;
StrStream: TStringstream;
begin
JpgStream := TMemoryStream.Create;
StrStream := TStringstream.Create(BaseStr);
DecodeStream(StrStream, JpgStream);
JpgStream.Position := 0;
result := TJpegImage.Create;
result.LoadFromStream(JpgStream);
StrStream.Free;
JpgStream.Free;
end;