OK, I found a simple way to do it on the Mac if you have Google Chrome.
In one sentence, it is to see the svg
image in a webpage (must be in an html
file), right click on image and choose "Copy Image" and paste to the Preview app.
Steps:
- Download or have the
svg
file in your hard drive, say, somefile.svg
- Now, in the same folder, just make an html file
tmp.html
that contains this line: <img src="somefile.svg">
- Now, open that html file in Google Chrome
- You should see the image. Now just right click on the image and choose "Copy Image"
- Go to Mac's Preview App, and choose,
"File -> New from Clipboard"
- Now
File -> Save
the file and you have the png
file. (or other file types).
This is tested on the current Chrome (version 48.0) on Mac OS X El Capitan.
Update: I am not sure whether it is due to some restriction imposed by Google Chrome. I just try an SVG file using Chrome 58.0, and I get a tiny image from the method above. If you see this case too, you can also use
<img src="somefile.svg" style="height: 82vh; margin-top: 9vh; margin-left: 9vh">
or if you want more margin, use:
<img src="somefile.svg" style="height: 62vh; margin-top: 19vh; margin-left: 19vh">
and you will have an image on screen good enough for you to do a screenshot -- using CmdShift4 or CmdShift3 on the Mac, for example. Make sure you resize your Chrome window to the maximum allowed on screen first.
2
I found a way if you have Google Chrome... and no need to install any other things: http://superuser.com/questions/134679/command-line-application-for-converting-svg-to-png-on-mac-os-x/1036841#1036841
– nonopolarity – 2016-02-07T19:06:39.013https://cairosvg.org/ works for python3 and seems to have no issue.
pip3 install cairosvg
– JayRizzo – 2019-05-24T20:31:50.280