无法从 Mac/OSX 运行 Gimp 批处理命令

时间:2021-03-11 03:36:01

标签: python macos gimp python-fu

我正在尝试让 Gimp 批处理 OSX 中的一些文件。我发现的最好的例子是这篇文章:How to run python scripts using gimpfu from command line?。但是,对于以批处理模式启动 Gimp,此示例以及所有其他示例的启动如下所示:

gimp -idf --batch-interpreter python-fu-eval -b "import sys;sys.path=['.']+sys.path;import batch;batch.run('./images ')" -b "pdb.gimp_quit(1)

不过,我不能只在 OSX 命令行中输入“gimp”。我必须输入“open /Applications/GIMP-2.10.app”,然后包含各种命令行参数会引发与“open”命令相关的错误。

我尝试在我的 bash 配置文件中创建别名,以便键入“gimp”启动“open /Applications/GIMP-2.10.app”,但我仍然遇到打开错误。

在 OSX 中我还需要做些什么才能输入“gimp”并使用命令行参数启动吗?

2 个答案:

答案 0 :(得分:0)

您需要将别名设为 /Applications/GIMP-2.10.app/Contents/MacOS/gimp。这就是传统的可执行文件所在的地方。或者,在 /usr/local/bin 中建立符号链接。

答案 1 :(得分:0)

蒂姆·罗伯茨 (Tim Roberts) 建议让我的别名 /Applications/GIMP-2.10.app/Contents/MacOS/gimp 起作用。虽然后来我了解到shell脚本不使用系统别名,但我至少有一个命令行别名,并且可以从shell脚本调用完整路径。

谢谢!