【问题标题】:How to save SVG file with Inkscape CLI?如何使用 Inkscape CLI 保存 SVG 文件?
【发布时间】:2013-09-08 22:16:16
【问题描述】:

我正在使用 Inkscape 在 cli no(--without-gui-z)中:

  1. 按id选择多个节点(hanzi,pinyin);
  2. 创建它们的联合;
  3. 另存为新文件 (test-union-cli.svg)。

命令

所以我使用这个命令:

inkscape -z -f ./䖠-x45A0.svg \
    --select=hanzi --select=pinyin \
    --verb SelectionUnion --verb FileSaveCopyAs \
    --verb=FileClose test-union-cli.svg

输出错误

** (inkscape:27462): CRITICAL *: Inkscape::XML::Document sp_repr_read_file(const gchar*, const gchar*): 断言 `Inkscape::IO::file_test(filename, G_FILE_TEST_EXISTS)' 失败

** (inkscape:27462): CRITICAL *: Inkscape::XML::Document sp_repr_read_file(const gchar*, const gchar*): 断言 `Inkscape::IO::file_test(filename, G_FILE_TEST_EXISTS)' 失败

** (inkscape:27462): WARNING **: 指定文档 test-union-cli.svg 无法打开(不存在或不是有效的 SVG 文件)

文件test-union-cli.svg 不应该存在。那么我在这里做错了什么?

【问题讨论】:

    标签: command-line svg inkscape


    【解决方案1】:

    tl;博士

    1. 您不能保存到与打开的文件不同的文件中。所以编辑一个副本;
    2. 动词需要GUI,不要使用-z--without-gui

    动词不带参数

    #inkscape上询问,发现目前(Inkscape 0.48.3.1 r9886 (Jan 29 2013))不支持动词参数:

    动词不带参数 -> 你不能保存你打开的文件 '-f' 以不同的名称首先复制文件(例如在脚本中), 并编辑并保存复制的文件

    关于此主题有一个已确认的错误(请参阅:Bug:Provide scriptable method of saving files)。

    动词暗示图形用户界面

    动词当前(稳定)总是需要打开 GUI(即使 无需交互)

    Bug 已被确认Allow suppressing the GUI (-z) when using --verb option(s) 并添加到白名单。

    临时解决方案

    较新版本的 Inkscape 可能会解决这个“问题”,目前您可以通过这样做来解决它

    cp 䖠-x45A0.svg test-union-cli.svg && inkscape -g -f ./test-union-cli.svg \
        --select=hanzi --select=pinyin --verb=SelectionUnion \
        --verb=FileSave --verb=FileClose
    

    希望 (v.049)

    改进正在进行中lp:~7-eric/inkscape/effectscript

    在此处阅读修订版 12388 的提交日志 https://code.launchpad.net/~7-eric/inkscape/effectscript - 这是 最近合并到主干中,AFAIU 允许通过以下方式运行 boolops 动词 没有图形用户界面的cli -> 可能下一个主要版本的 inkscape (0.49) 将有更好的 cli 支持

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-01-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-10-04
    • 1970-01-01
    • 2021-10-09
    • 2014-10-17
    相关资源
    最近更新 更多