我跟着this教程,這就是我想出迄今:瘸子:Python腳本在菜單中沒有顯示
#!/usr/bin/python
# -*- coding: utf-8 -*-
#http://www.ibm.com/developerworks/library/os-autogimp/
from gimpfu import*
def plugin_main(timg, tdrawable, maxh=540, maxw=800):
currentWidth = tdrawable.width
currentHeight = tdrawable.height
newWidth = currentWidth
newHeight = currentHeight
if (maxw < newWidth):
newWidth = maxw
newHeight = (float(currentHeight)/(float(currentWidth)/newWidth))
if (maxh < newHeight):
newHeight = maxh
newWidth = (float(currentWidth)/(float(currentHeight)/newHeight))
pdb.gimp_image_scale(timg, newWidth, newHeight)
register(
"python_fu_resize",
"Saves the image at a maximum width and height",
"Saves the image at a maximum width and height",
"N N",
"N N",
"2013",
"<Image>/Image/Resize to max...",
"*",
[],
[],
plugin_main)
main()
但插件woun't在GIMP菜單顯示出來(我使用GIMP 2.8)。給文件chmod a + x權限。文件位置可能是一個問題:/.gimp-2.8/plug-ins/src/resize.py? src是由於日食。
做了一些修改:添加了缺失的空間並將腳本移到了'/ usr/lib/gimp/2.0/plug-ins'中。現在它出現在菜單中。謝謝。 – kyng
調試的另一個提示:從命令行啓動gimp,您可以看到出現的錯誤消息類型。 – kyng
確保腳本是可執行的。運行'$ chmod + x plugin.py'爲我解決了這個問題。 – arunkumar