DataURL() -method that returns a base-coded pixel representation of the. Seeing as an SVG is a human- readable xml string, using baseencoding is not mandatory. Instea we can use . Prerequisite: To understand this blog, basic knowledge of javascript and djs are.
Here, canvasUrl is your baseencoded image url.
It supports raster images (.jpg,.png) as well. On the right, that same image baseencoded with all safe characters. We can then use toDataURL() to make a base. The drawing was an inline SVG and it had to be downloaded.
You can convert an inline SVG to a baseencoded string with the btoa . It seems that Chrome finally found a way to let us convert from svg to. I was recently working on an internal project and needed to convert some Scalable Vector Graphics ( SVG ) images to Baseencoded strings. I was already using React with some SVG so this was the obvious choice.
I started searching for. SVG is awesome but sometimes you want to convert it into an image format. SVG , convert it into a base. Read More