<img> to base64

Hello,

I need to get the base64 data of an img declared in my template from :
<img id="myimage" src="http://myserver/myimage.jpg">

Is there a way to get a base64 string of the content of the img file ?