Skip to content Skip to sidebar Skip to footer

Convert Image To Base64 Javascript On Firefox

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

Solution 1:

You could use the canvas element and draw the image using drawImage() onto it, then use toDataURL() to get the base64 encoded image.

see: https://developer.mozilla.org/en/html/canvas

Post a Comment for "Convert Image To Base64 Javascript On Firefox"