今天群里讨论对图片进行BASE64编码的问题就简单的写了下。
编码:

procedure TForm1.btn1Click(Sender: TObject);
var
  fs :TFileStream;
  ss:TStringStream;
begin
  fs := TFileStream.Create('1.jpg',fmOpenRead);
  ss := TStringStream.Create;
  try
    TNetEncoding.Base64.Encode(fs,ss);
    mmo.Text := ss.DataString;
  finally
    fs.Free;
    ss.Free;
  end;
end;

解码:

procedure TForm1.btn2Click(Sender: TObject);

var
  ss:TStringStream;
  fs:TFileStream;
begin
  ss := TStringStream.Create(mmo.Text);
  fs := TFileStream.Create('2.jpg',fmOpenWrite + fmCreate);
  try
  TNetEncoding.Base64.Decode(ss,fs) ;
  finally
    fs.Free;
    ss.Free;
  end;
end;