Useful Snippets

Useful Snippets


This blog is used to collect useful snippets related to Linux, PHP, MySQL and more. Feel free to post comments with improvements or questions!

July 2020
M T W T F S S
 12345
6789101112
13141516171819
20212223242526
2728293031  

Categories


SVG to PNG conversion with transparent background in ImageMagick

Stanislav KhromovStanislav Khromov

Here’s a quick way to convert SVG to PNG with transparent background

convert -background none image.svg image.png

Adjust size

If you want to scale the image to a larger size without antialiasing (which makes the image look fuzzy), you can add the density parameter, like this:

convert -density 200 -background none image.svg image.png

Simply increase the density value to increase the image size.

To install ImageMagick on OS X with Homebrew:

brew install imagemagick

For Ubuntu:

sudo apt-get install imagemagick

Web Developer at Aftonbladet (Schibsted Media Group)
Any opinions on this blog are my own and do not reflect the views of my employer.
LinkedIn
Twitter
WordPress.org Profile
Visit my other blog

Comments 1
  • Tim
    Posted on

    Tim Tim

    Reply Author

    In Mint 17.2 (and probably others), the librsvg2-bin package is also required.