Somewhere I found this code to convert a BitMap to a string:
function Base64FromBitmap(Bitmap: TBitmap): string;
var
Input: TBytesStream;
Output: TString
Soap.EncdDecd.EncodeStream()
is hard-coded to output a line break every 75 characters. The only way to change that is to make a copy of Soap.EncdDecd.pas
, edit it, and then add the copy to your project (and this approach does not work if your project has Runtime Packages enabled).
You can use Indy's TIdEncoderMIME
class as an alternative. It does not output line breaks:
uses
..., IdCoderMIME;
function Base64FromBitmap(Bitmap: TBitmap): string;
var
Input: TMemoryStream;
begin
Input := TMemoryStream.Create;
try
Bitmap.SaveToStream(Input);
Input.Position := 0;
Result := TIdEncoderMIME.EncodeStream(Input);
finally
Input.Free;
end;
end;