inkscape shell 模式

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

我尝试通过在 .bat 文件中写入这些行来运行 inkscape shell 模式:

inkscape --shell
>2.svg -e 2.png
但它根本不起作用(没有 png 文件),而且我尝试打开当前的 svg 输入,发现它已损坏,并且根本无法打开它。 谁能告诉我进入 SHELL 模式并执行其他 inkscape 命令行的正确命令行吗?

svg shellexecute inkscape
3个回答
4
投票

您正在使用

>
将输出重定向到 2.svg。
>
表示将输出重定向到此文件。

可能更正确的是:

rem echo the commands you want to execute to a file
echo 2.svg -e 2.png > commands.txt
echo quit >> commands.txt
inkscape --shell < commands.txt

不确定这是否有效,因为我不使用 Windows。


0
投票

这是一个重新设计的示例,之前使用如下标志导出:

$ inkscape src/cursors.svg \
  -i wait-22 -w 24 -h 24 -o build/x75/wait-22.png \
  -i progress-22 -w 24 -h 24 -o build/x75/progress-22.png

现在已在

--shell
模式下使用 Bash 和 Inkscape 的操作。
编辑 Plasma 的 Breeze 光标构建脚本的摘录:

RAWSVG="src/cursors.svg"
SCALES="50 75 100 125 150 175 200 225 250 275 300"
genPixmaps="file-open:${RAWSVG};"
for CUR in src/config/*.cursor; do
    BASENAME=${CUR##*/}
    BASENAME=${BASENAME%.*}

    for scale in $SCALES; do
        DIR="build/x${scale}"
        # Check if the final PNG already exists, in which case skip generating it 
        if [[ "${DIR}/${BASENAME}.png" -ot ${RAWSVG} ]]; then
            genPixmaps="${genPixmaps} export-id:${BASENAME}; export-width:$((32*scale/100)); export-height:$((32*scale/100)); export-filename:${DIR}/${BASENAME}.png; export-do;"
        fi
    done
done
# Push the entire genPixmaps var as a file to inkscape --shell
inkscape --shell < <(echo "${genPixmaps}")

这最终会产生这种高效的单行混乱:

file-open:src/cursors.svg; export-id:alias; export-width:16; export-height:16; export-filename:build/x50/alias.png; export-do;export-id:alias; export-width:24; export-height:24; export-filename:build/x75/alias.png; ...

请参阅

inkscape --action-list
获取可能操作的列表。


-3
投票

将 SVG 导出为不同格式

  • 导出位图(png)

    inkscape -f FILENAME.svg -e FILENAME.png

    加载 FILENAME.svg 并将其导出到 FILENAME.png

    inkscape -f FILENAME.svg -w WIDTH -h HEIGHT -e FILENAME.png

    加载 FILENAME.svg 并将其导出到 FILENAME.png,宽度尺寸为 WIDTH,高度尺寸为 HEIGHT,以像素为单位

  • 导出为pdf

    inkscape -f FILENAME.svg -A FILENAME.pdf

    加载 FILENAME.svg 并将其导出到 FILENAME.pdf

  • 导出到ps

    inkscape -f FILENAME.svg -P FILENAME.ps

    加载 FILENAME.svg 并将其导出到 FILENAME.ps

  • 导出到 eps

    inkscape -f FILENAME.svg -E FILENAME.eps

    加载 FILENAME.svg 并将其导出到 FILENAME.eps

外部链接:

© www.soinside.com 2019 - 2024. All rights reserved.