How to convert a SVG to a PNG with ImageMagick?

前端 未结 18 2140
一个人的身影
一个人的身影 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:45

    I haven't been able to get good results from ImageMagick in this instance, but Inkscape does a nice job of it on Linux and Windows:

    inkscape -z -w 1024 -h 1024 input.svg -e output.png
    

    Edit (May 2020): Inkscape 1.0 users, please note that the command line arguments have changed:

    inkscape -w 1024 -h 1024 input.svg --export-filename output.png
    

    (on macOS, you may need to use --export-file instead of --export-filename).

    Here's the result of scaling a 16x16 SVG to a 200x200 PNG using this command:

    enter image description here

    enter image description here

    Just for reference, my Inkscape version (on Ubuntu 12.04) is:

    Inkscape 0.48.3.1 r9886 (Mar 29 2012)
    

    and on Windows 7, it is:

    Inkscape 0.48.4 r9939 (Dec 17 2012)
    

提交回复
热议问题