如何用Inkscape CLI保存SVG文件? [英] How to save SVG file with Inkscape CLI?
问题描述
我使用Inkscape在cli no( - 无-gui
或 -z
):
- 以id(
hanzi
,拼音
); - 创建它们的并集;
- 另存为新文件-union-cli.svg )。
命令
$ b b
所以我使用这个命令:
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 *):assertion
Inkscape :: IO :: file_test(filename,G_FILE_TEST_EXISTS )'failed
**(inkscape:27462):CRITICAL * :Inkscape :: XML :: Document sp_repr_read_file(const gchar *,const gchar *):assertion
`Inkscape :: IO :: file_test(filename,G_FILE_TEST_EXISTS)'
**(inkscape:27462) :指定的文档test-union-cli.svg无法打开(不存在或不是有效的SVG文件)
文件 test-union-cli.svg
不应存在。那么我在这里做错了什么?
tl; dr
- 您无法保存到打开的文件以外的其他文件。因此请修改副本;
- 动词需要GUI ,不要使用
-z
或<$ - Select multiple nodes by id (
hanzi
,pinyin
) ; - Create an union of them ;
- Save as a new file (
test-union-cli.svg
). - You can't save to a different file than the one open. So edit a copy ;
- Verb need the GUI, don't use
-z
or--without-gui
.
$ b
问: #inkscape
,它出来了,目前( Inkscape 0.48.3.1 r9886 )
)不支持动词的参数:
动词不接受参数 - >您不能保存文件您使用
'-f'以不同的名称打开文件(例如在脚本中),
并编辑并保存复制的文件
有关此主题的 错误(请参阅: Bug:提供可脚本化的保存文件的方法)。
动词含义GUI
动词目前(有稳定)总是需要打开GUI(即使
不需要交互)
已确认错误在使用--verb选项时允许压缩GUI(-z)和
临时解决方案
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
Hope(v.049)
改进正在进行中 lp:〜7-eric / inkscape / effectscript :
在这里读取修订版12388的提交日志
https://code.launchpad.net/~7-eric/inkscape/effectscript - 这是
合并到trunk最近,并且AFAIU允许通过$ b $运行boolops动词b cli没有GUI
- >很可能下一个主要版本的inkscape(0.49)将有更好的cli支持
I'm working with Inkscape in cli no (--without-gui
or -z
) to :
Command
So I use this command:
inkscape -z -f ./䖠-x45A0.svg \
--select=hanzi --select=pinyin \
--verb SelectionUnion --verb FileSaveCopyAs \
--verb=FileClose test-union-cli.svg
Output error
** (inkscape:27462): CRITICAL *: Inkscape::XML::Document sp_repr_read_file(const gchar*, const gchar*): assertion `Inkscape::IO::file_test( filename, G_FILE_TEST_EXISTS )' failed
** (inkscape:27462): CRITICAL *: Inkscape::XML::Document sp_repr_read_file(const gchar*, const gchar*): assertion `Inkscape::IO::file_test( filename, G_FILE_TEST_EXISTS )' failed
** (inkscape:27462): WARNING **: Specified document test-union-cli.svg cannot be opened (does not exist or not a valid SVG file)
The file test-union-cli.svg
is not supposed to exists. So what am I doing wrong here?
tl;dr
Verbs don't take parameters
Asked on #inkscape
and it come out that currently (Inkscape 0.48.3.1 r9886 (Jan 29 2013)
) doesn't support verb's parameters:
verbs do not take arguments -> you cannot save a file you opened with '-f' under a different name copy the file first (e.g. in the script), and edit and save the copied file
There is a bug confirmed on this topic (see: Bug:Provide scriptable method of saving files).
Verb imply GUI
verbs currently (with stable) always require to open the GUI (even if no interaction is required)
Bug is confirmed Allow suppressing the GUI (-z) when using --verb option(s) and added to whishlist.
Temporary Solution
Newer version of Inkscape may fix this "issue", currently you can solve it by doing
cp 䖠-x45A0.svg test-union-cli.svg && inkscape -g -f ./test-union-cli.svg \
--select=hanzi --select=pinyin --verb=SelectionUnion \
--verb=FileSave --verb=FileClose
Hope (v.049)
Improvement is on its way lp:~7-eric/inkscape/effectscript:
read the commit log of revision 12388 here https://code.launchpad.net/~7-eric/inkscape/effectscript - this was merged into trunk recently, and AFAIU allows to run boolops verbs via cli without GUI -> likely the next major version of inkscape (0.49) will have better cli support
这篇关于如何用Inkscape CLI保存SVG文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!