Hi Josh Anglesea, thanks for replying.
In the suggested solution, following line of code will not work in my case.
TenantMedia.Get(Item.Picture.Item(1));
Because Microsoft is using media datatype for field picture. And there is a procedure Item which takes an index as a parameter.
Whereas, I'm using blob data type in a custom page.
Well my issue is solved by the following procedure:
procedure getBase64(): Text
var
Base64CU: Codeunit "Base64 Convert";
DataBase64: Text;
VarInStream: InStream;
begin
Rec.CalcFields("Upload New Image");
Rec."Upload New Image".CreateInStream(VarInStream);
DataBase64 := Base64CU.ToBase64(VarInStream);
exit(DataBase64);
end;