使用 inkscape 命令行失败将 svg 转换为 png

Converting svg to png with inkscape command line failing

我觉得我一定是在做一些愚蠢的错误,但我就是无法让它发挥作用。这是命令我是 运行 从 cmd:

inkscape.com "C:\path\ship.svg" -e --export-png="C:\Path\ship.png" --without-gui

在return中,我得到:

WARNING: File path "--export-png=C:\path\ship.png" includes directory that doesn't exist.

确实存在。我错过了什么?

您应该使用 -e--export-png,而不是同时使用,因为它们的意思相同。

但是 According to the docs-e--export-png 不再可用。您应该改用 -o--export-filename=FILENAME。而且,您只能使用其中一个,因为 -o 只是 --export-filename.

的快捷方式
inkscape "C:\path\ship.svg" -o "C:\path\ship.png"

inkscape "C:\path\ship.svg" --export-filename="C:\path\ship.png"

只是 2021 年的更新(应该在一行中输入 - 分解只是为了便于阅读)

inkscape 
    --export-width=128 
    --export-type=png 
    --export-filename="C:\path\ship.png" "C:\path\build.svg"

或者如果您想要透明的 PNG,请将 --export-background-opacity=0 添加到调用参数中:

inkscape
    --export-background-opacity=0
    --export-width=128
    --export-type=png 
    --export-filename="C:\path\ship.png" "C:\path\build.svg"

在 inkscape 版本 1.0.2 中可以使用以下命令:

inkscape --export-type="png" myfile.svg --export-filename=myfile.png