SVG to JPG / PNG

后端 未结 4 1335
暗喜
暗喜 2021-02-20 14:57

Is there any working module to convert a SVG image into a pixel format like JPEG or PNG?

4条回答
  •  礼貌的吻别
    2021-02-20 15:09

    We can also use command line interface such as inkscape to achieve it. Download inkscape from inkscape.org

    Open Terminal/command prompt Type command as:

    single file conversion

    inkscape -z --file=original.svg --export-png=converted.png --export-area-drawing --export-dpi=200
    

    Batch conversion of SVG's to PNG can be achieved as follows :

    for i in *.svg; 
       do inkscape -z --file=$i --export-png=$i.png --export-area-drawing --export-dpi=200; 
    done
    

    --export-area-drawing : This will only export the drawing area of SVG file and not the whole document area.

提交回复
热议问题