I believe you would need to do this with Javascript using the Web Viewer. This topic has a demo of that: Base64 encoding in drag and drop - #9 by muneer
And this has a script and screenshots: [Solved] how do I base64 encode an image? - #2 by kartik14