I need to convert image that are in a webpage to base64 over greasemonkey or firefox .xpi extension.
How can i do it?
I know that i have btoa() function, but i only can use it with strings, not with images.
Little help here.
Thanks.
I need to convert image that are in a webpage to base64 over greasemonkey
Share
You could use the
canvaselement and draw the image usingdrawImage()onto it, then usetoDataURL()to get the base64 encoded image.see: https://developer.mozilla.org/en/html/canvas