我去过Gimp: python脚本没有显示在菜单中,但这对我没什么帮助。这是我试过的,一步一步地:
1.GIMP2.8.16在MacOSX10.9.5命令行上运行,文件包括gimp
alias gimp='/Applications/GIMP.app/Contents/MacOS/GIMP --verbose --console-messages '我查看终端输出,我看到了很多消息,但是没有什么问题(您想在这里转储吗?)我从一开始就看到了,Enabling internal Python...,所以这应该是好的。
2.过滤器>Python>控制台打开控制台
GIMP 2.8.16 Python Console
Python 2.7.8 (default, Dec 5 2015, 09:38:54)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.57)]
>>> -so,再一次,python似乎正在工作。
3.由于这里的小费,我尝试运行这里的小费脚本。我打开一个图像并运行过滤器>呈现>云>雾。它的工作原理就像一个魔咒- in,当窗口亮起时,我确实会收到一些类型转换警告:
** (foggify.py:30312): WARNING **: Trying to register gtype 'GMountMountFlags' as enum when in fact it is of type 'GFlags'
** (foggify.py:30312): WARNING **: Trying to register gtype 'GDriveStartFlags' as enum when in fact it is of type 'GFlags'
** (foggify.py:30312): WARNING **: Trying to register gtype 'GSocketMsgFlags' as enum when in fact it is of type 'GFlags'我搜索了我的计算机,foggify.py实际上是在/Applications/GIMP.app/Contents/Resources/lib/gimp/2.0/plug-ins/foggify.py中,所以这证明了Python是有效的,但并不是它正在加载脚本。我有点困惑,因为foggify.py只有77行,而不是30312行。
4. GIMP >>>文件夹>脚本显示GIMP应该为脚本加载以下目录:
/Users/julio/Library/Application Support/GIMP/2.8/scripts
/Applications/GIMP.app/Contents/Resources/share/gimp/2.0/scripts我不使用/Applications/GIMP.app/Contents/Resources/share/gimp/2.0/scripts,但是它有很多*.scm文件(所以,很可能都在Scheme中)。我自己也没在这里加任何东西。
5. i只有一个脚本:ls -l "/Users/julio/Library/Application Support/Gimp/2.8/scripts"生成
total 8
-rwxr-xr-x 1 julio staff 654 25 Jun 16:25 minimal.py(仅此而已)
6.,这是我的minimal.py
#!/usr/bin/env python
from gimpfu import *
def minimal():
pass
register(
"python_fu_minimal", # plugin name
"Minimal plug-in example", # blurb (short description)
"Show the smallest possible Python plug-in example", # help (long description)
"Michael Schumacher", # author
"Michael Schumacher", # copyright info
"2007", # date
"<Image>/Tools/Minimal", # menu position and label
None, # image types accepted
[], # input parameters
[], # output (results)
minimal # method to call
)
main()7. --我已经在上面提到的scripts目录中使用minimal.py运行gimp,并且在“Tools”菜单中看不到任何“最小”项。
我还尝试了下面的变体,这也不起作用:
#!/usr/bin/env python
from gimpfu import *
def minimal():
pass
register(
"python_fu_minimal", # plugin name
"Minimal plug-in example", # blurb (short description)
"Show the smallest possible Python plug-in example", # help (long description)
"Michael Schumacher", # author
"Michael Schumacher", # copyright info
"2007", # date
"Minimal", # menu position and label
None, # image types accepted
[], # input parameters
[], # output (results)
minimal, # method to call
menu="<Image>/Tools"
)
main()发布于 2016-06-26 11:22:53
Python“脚本”在技术上是“插件”,因此应该位于“插件”子目录(/Users/julio/Library/Application Support/GIMP/2.8/插件)。
更新2.10: gimp2.10仍然支持2.8方式,.py文件放在plug-ins目录中,但它也支持新的样式,其中.py (实际上是主要插件可执行文件)位于同名plug-ins的子目录中,还有它可能需要的其他文件(如果有的话)。AFAIK,这将是未来Gimp版本中唯一被接受的方式。
{Your Gimp profile}
└── plug-ins
├── some_2.08_plugin.py
├── another_2.08_plugin.py
├── some_plugin_for_2.10_and_beyond
│ ├── some_plugin_for_2.10_and_beyond.py
│ └── some_python_module.py
└── another_plugin_for_2.10_and_beyond
├── another_plugin_for_2.10_and_beyond.py
└── another_auxiliary_file.dathttps://stackoverflow.com/questions/38030656
复制相似问题