Convert SVG file to multiple different size PNG files

后端 未结 7 1124
轻奢々
轻奢々 2021-01-30 09:10

I have a logo image in SVG format and I am wondering if theres a way to generate multiple different sized png files.

Eg, I set 20 different width and height and it gener

7条回答
  •  無奈伤痛
    2021-01-30 09:58

    Here's how to make it much faster (3x for me for just 5 exports on an SSD) by launching Inkscape just once, and how to export the images to different directories (as Android uses):

    #!/bin/sh
    # Converts the Inkscape icon file ic_launcher_web.svg to the launcher web & app png files.
    
    PROJECT="My Project Name"
    INPUT="source-assets/ic_launcher_web.svg"
    MAIN="${PROJECT}/src/main/"
    RES="${MAIN}res/"
    DRAWABLE="${RES}/drawable"
    
    inkscape --shell <

    This is a bash shell script. On Windows you can run it in MINGW32 (e.g. GitHub's Git Shell) or convert it to a Windows DOS shell script. (For a DOS script, you'll have to change the "here document" COMMANDS into something DOS can handle. See heredoc for Windows batch? for techniques such as echoing multiple lines of text to a temp file.)

提交回复
热议问题