Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

decode base64 svg data to a svg file

I have a file containing a svg image which is base64 encoded (data-uri). The file starts with

data:image/svg+xml;base64,PHN....

How to decode this to a .svg file in linux ?

like image 744
ni_hao Avatar asked Feb 26 '14 10:02

ni_hao


People also ask

How do I decode Base64 files?

To decode a file with contents that are base64 encoded, you simply provide the path of the file with the --decode flag. As with encoding files, the output will be a very long string of the original file. You may want to output stdout directly to a file.

How do you decode an image Base64 flutter?

Decode Base64 to Image To convert a Base64 String into Image, we need to do 2 steps: use base64Decode() function which is shorthand for base64. decode() to decode Base64 to bytes . Uint8List base64Decode(String source) => base64.


2 Answers

You can copy/paste the string (data:imageetc included) in the url bar of a modern browser; it will decrypt it for you, then you can simply save the page as an svg.

like image 52
Iazel Avatar answered Sep 17 '22 10:09

Iazel


You could use an online base64 decoder, such as http://www.base64decode.org/

like image 31
Paul LeBeau Avatar answered Sep 19 '22 10:09

Paul LeBeau