I am having trouble converting binary code to base64. Basically I need the next format to attach images to Dynamics 365 F&O: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAoAAAAHgCAYAAAA10dzkAAAAAXNSR0IArs4c6Q .... "
In the next picture I show pictures taken from my computer (picture 1) with the correct Base64 format (notice that starts with IVBor) and another picture that is a screenshot of my cellphone (picture 2) with the wrong format.

Does anyone knows how to tackle this issue?
Best regards