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

问题描述 投票:0回答:3

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

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

作为回报,我得到:

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

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

svg png inkscape
3个回答
28
投票

您应该使用

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

但是根据文档

-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"

11
投票

只是 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"

1
投票

在 inkscape 版本 1.0.2 中,以下命令将起作用:

inkscape --export-type="png" myfile.svg --export-filename=myfile.png
© www.soinside.com 2019 - 2024. All rights reserved.