JSON is not a very suitable format for sending bitmaps and there is no default way for converting binary content into JSON, but you could use the TBitmap.SaveToStream() method to save the content of the TBitmap into a TStream, which will be mime-encoded when you use the "toJSON" method. Ofcourse, you will need to reverse the process on the other side to get the Bitmap back.
uses rtcInfo;
function BitmapToJSONString(bmp:TBitmap):RtcString;
var
myRecord:TRtcRecord;
myStream:TStream;
begin
myRecord := TRtcRecord.Create;
try
myStream := myRecord.newByteStream('Image');
bmp.SaveToStream( myStream );
Result := myRecord.toJSON;
finally
myRecord.Free;
end;
end;
Best Regards,
Danijel Tkalcec