我觉得我一定是在做一些愚蠢的错误,但我就是无法让它发挥作用。这是我从 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.
确实存在。我错过了什么?
您应该使用
-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"
只是 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