How to convert a SVG to a PNG with ImageMagick?

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

    This is not perfect but it does the job.

    convert -density 1200 -resize 200x200 source.svg target.png
    

    Basically it increases the DPI high enough (just use an educated/safe guess) that resizing is done with adequate quality. I was trying to find a proper solution to this but after a while decided this was good enough for my current need.

    Note: Use 200x200! to force the given resolution

提交回复
热议问题