Inkscape CLI 使用终端/CLI 将 svg 批量转换为 eps

Inkscape CLI 使用终端/CLI 将 svg 批量转换为 eps

我正在尝试将 svg 矢量文件批量转换为 EPS 文件,但遇到了麻烦。

我正在使用的命令:

for file in /tmp/0/*.svg; do inkscape "$file" -o "${file%svg}eps" --export-ignore-filters --export-ps-level=3; done

我收到的错误:

Gtk-Message: 12:09:52.418: Failed to load module "canberra-gtk-module"
Gtk-Message: 12:09:52.420: Failed to load module "canberra-gtk-module"

** (org.inkscape.Inkscape:948538): WARNING **: 12:09:52.682: Can't open file: /tmp/0/test20016.svg (doesn't exist)

** (org.inkscape.Inkscape:948538): WARNING **: 12:09:52.682: Can't open file: /tmp/0/test20016.svg (doesn't exist)
ink_file_open: '/tmp/0/test20016.svg' cannot be opened!
InkscapeApplication::document_open: Failed to open: /tmp/0/test20016.svg
ConcreteInkscapeApplication::on_open: failed to create document!
Gtk-Message: 12:09:52.956: Failed to load module "canberra-gtk-module"
Gtk-Message: 12:09:52.958: Failed to load module "canberra-gtk-module"

** (org.inkscape.Inkscape:948666): WARNING **: 12:09:53.223: Can't open file: /tmp/0/test20022.svg (doesn't exist)

** (org.inkscape.Inkscape:948666): WARNING **: 12:09:53.224: Can't open file: /tmp/0/test20022.svg (doesn't exist)
ink_file_open: '/tmp/0/test20022.svg' cannot be opened!
InkscapeApplication::document_open: Failed to open: /tmp/0/test20022.svg
ConcreteInkscapeApplication::on_open: failed to create document!

该文件在那里,可以使用 Inkscape 的 GUI 打开

我正在使用 Inkscape 的 snap 版本: Inkscape 1.2.2(b0a8486541,2022-12-01,自定义)

inkscape /tmp/0/test20016.svg

无法打开文件:

Gtk-Message: 12:30:49.665: Failed to load module "canberra-gtk-module"
Gtk-Message: 12:30:49.667: Failed to load module "canberra-gtk-module"

** (org.inkscape.Inkscape:966787): WARNING **: 12:30:49.981: Can't open file: /tmp/0/test20016.svg (doesn't exist)

** (org.inkscape.Inkscape:966787): WARNING **: 12:30:49.981: Can't open file: /tmp/0/test20016.svg (doesn't exist)
ink_file_open: '/tmp/0/test20016.svg' cannot be opened!
InkscapeApplication::document_open: Failed to open: /tmp/0/test20016.svg
ConcreteInkscapeApplication::on_open: failed to create document!

其他命令按预期工作:

$ for file in /tmp/0/*.svg; do ls "$file"; done 
/tmp/0/test20016.svg 
/tmp/0/test20022.svg

我做了sudo apt install libcanberra-gtk-module libcanberra-gtk3-module,但仍然有问题堪培拉-gtk-模块

我正在运行 Ubuntu 20.04 LTS: Linux sys76 5.15.0-57-generic #63~20.04.1-Ubuntu SMP 星期三 11 月 30 日 13:40:16 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 20.04.5 LTS
Release:    20.04
Codename:   focal

答案1

感谢特登感谢你们与我合作。

刚刚用 appimage 尝试了一下并且成功了......(因此此 snap 在一些 CLI 命令上存在问题)

我用来让它工作的命令。

1- 下载应用程序图像 https://inkscape.org/release/inkscape-1.2.2/gnulinux/appimage/dl/

2-chmod u+x Inkscape-b0a8486-x86_64.AppImage

3-运行命令:

for file in /tmp/0/svg/*.svg; do ./Inkscape-b0a8486-x86_64.AppImage "$file" -o "${file%svg}eps" --export-ignore-filters --export-ps-level=3; done

相关内容