10
votes
A quick method for saving an SVG as a PNG
When I need an avatar, I use boringavatars.com -- but instead of using the site, I use this url with a generator I made in Google Sheets.
The trouble is, it spits out an SVG. To quickly save it, right click on the SVG > Inspect > right click <rect width=...
and select 'capture node screenshot'
There are extensions that do this or something similar, but unless you're exporting SVGs in bulk, they're largely unnecessary.
If you have Image Magick installed on your PC, I whipped up a quick powershell script for you.
https://hastebin.com/exudamavih.php (disregard .php, no idea why hastebin would create such a link)
It probably works. It creates a new .png file with random filename in your current working directory.
-Variant
is mandatory,-Size
defaults to 600, and the rest should be self-explanatory I guess. Example usage:https://i.imgur.com/vV6f2w8.png
oh nice. I'm on macos. I think I can install libsvg with it.
Your powershell looks a lot better than mine. I should get into ricing it, even though I rarely use it :)
for me, I couldn't get it working. The flag --with-librsvg is invalid. There's some discussion on github, but no real solution, so far as I could see.
I've been using Figma to convert or edit SVGs.
Inkscape can export files to .png via command line