Convert svg images to PNG or JPEG

There are a large number of SVG images available. You need to convert them to PNG or JPEG. What is better to use?

Author: 0xdb, 2017-09-11

3 answers

Imagemagick, inkscape: both are able to convert images from the command line

 1
Author: n3r0bi0m4n, 2017-09-11 23:38:19

Use the wonderful Inkscape package that has image import/export options. To date, this is the best render you can find. Just run inkscape --help and immerse yourself in the world of amazing features that this beautiful program provides.

Of course, there is another option: you install Chrome and use the Canvas tag to render all the images in HTML5. You do not need to install the software at all, you can use site visitors as a distributed botnet for computing and rendering, which in the world of the winning HTML5 is a great practice and available to everyone!

 1
Author: bukkojot, 2019-03-09 10:28:36

It is better to use PNG. JPEG is intended for photos only. Something like that:

for f in *.svg ; do convert -background transparent -density 1000 "$f" "${f%svg}png" ; done

Details about all the parameters are written here: https://www.imagemagick.org/script/convert.php

But in general, SVG is a format that is best used as is, if possible. You can lose a lot in both quality and volume when converting a vector to a raster.

 0
Author: Beast Winterwolf, 2017-09-17 03:04:40