2017-08-04 53 views
1

我嘗試在python命令行中使用偉大的Beautify插件,我無法以正確的方式調用該函數!GIMP python-fu調用函數plug_in_beautify'參數數量錯誤'

這裏是我的代碼:

import os 
from gimpfu import * 

inputPath = os.path.join('xxxx', 'fire.png') 

if(file.lower().endswith(('.png'))): 
    image = pdb.file_png_load(inputPath, inputPath) 
if(file.lower().endswith(('.jpeg', '.jpg'))): 
    image = pdb.file_jpeg_load(inputPath, inputPath) 

drawable = pdb.gimp_image_get_active_layer(image) 
pdb.plug_in_beautify(1,image,drawable,67,100) 
# Traceback (most recent call last): 
# File "<input>", line 1, in <module> 
# TypeError: wrong number of parameters 

pdb.plug_in_beautify.nparams # = 5 
pdb.plug_in_beautify.params 
# ((0, 'run-mode', 'The run mode { RUN-INTERACTIVE (0), RUN-NONINTERACTIVE (1) }'), 
# (13, 'image', 'Input image'), 
# (16, 'drawable', 'Input drawable'), 
# (0, 'effect', 'The effect to apply { SOFT_LIGHT (1), WARM (2), SHARPEN (3), SOFT (4), REMOVE_FOG (5), STRONG_CONTRAST (6), SMART_COLOR (7),... PINK_PURPLE_GRADIENG (80), PINK_BLUE_GRADIENT (81) }'), 
# (3, 'opacity', 'The effect opacity (0 <= opacity <= 100)')) 

那麼,爲什麼我的功能有「錯誤的參數數量」,如果它預計5,我把5?

任何人都可以用正確的語法來幫助我嗎? IMO運行模式不應該被輸入

回答

1

編輯: 輸入pdb.plug_in_beautify(圖像,可拉伸,67100)

運行模式中不使用(不是必需的)用蟒

+0

非常感謝!完美地工作! – jcs