How to convert a SVG to a PNG with ImageMagick?

前端 未结 18 2141
一个人的身影
一个人的身影 2020-11-28 17:04

I have a SVG file that has a defined size of 16x16. When I use ImageMagick\'s convert program to convert it into a PNG, then I get a 16x16 pixel PNG which is way too small:<

18条回答
  •  误落风尘
    2020-11-28 17:33

    Without librsvg, you may get a black png/jpeg image. We have to install librsvg to convert svg file with imagemagick.

    Ubuntu

     sudo apt-get install imagemagick librsvg
     convert -density 1200 test.svg test.png
    
    

    MacOS

     brew install imagemagick librsvg
     convert -density 1200 test.svg test.png
    
    

提交回复
热议问题